Same name and namespace in other branches
  1. 7.x-3.x plugins/QuickQtabsContent.inc \QuickQtabsContent::render()

Overrides QuickContentRenderableInterface::render

Fichier

src/Plugin/QuickContent/QuickQtabsContent.php, line 57

Classe

QuickQtabsContent
Class for tab content of type "qtabs" - this is for rendering a QuickSet instance as the tab content of another QuickSet instance. @QuicktabFormat{ id = "quickqtabscontent" }

Namespace

Drupal\quicktabs\Plugin\QuickContent

Code

public function render($hide_empty = FALSE, $args = array()) {
    if ($this->rendered_content) {
        return $this->rendered_content;
    }
    $item = $this->settings;
    if (!empty($args)) {
        // The args have been passed in from an ajax request.
        // The first element of the args array is the qt_name, which we don't need
        // for this content type.
        array_shift($args);
        $item['machine_name'] = $args[0];
    }
    $output = array();
    if (isset($item['machine_name'])) {
        $quicktabs = quicktabs_load($item['machine_name']);
        if ($quicktabs) {
            $contents = $quicktabs->tabs;
            $name = $quicktabs->machine_name;
            unset($quicktabs->tabs, $quicktabs->machine_name);
            $options = (array) $quicktabs;
            $qt = QuickSet::QuickSetRendererFactory($name, $contents, $quicktabs->renderer, $options);
            if ($qt) {
                $output = $qt->render();
            }
        }
    }
    $this->rendered_content = $output;
    return $output;
}