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

Return value

array

Overrides QuickRenderer::render

Fichier

src/Plugin/QuickRender/QuickUiTabs.php, line 33

Classe

QuickUiTabs
Renders the content using the jQuery UI Tabs widget.

Namespace

Drupal\quicktabs\Plugin\QuickRender

Code

public function render() {
    $quickset = $this->quickset;
    $active_tab = $quickset->getActiveTab();
    $tabs = $this->build_tablinks($active_tab);
    $qt_name = $quickset->getName();
    $render_array = array(
        '#attached' => $this->add_attached(),
        'content' => array(
            '#theme' => 'qt_ui_tabs',
            '#options' => array(
                'attributes' => array(
                    'id' => 'quicktabs-' . $qt_name,
                    'class' => 'quicktabs-ui-wrapper',
                ),
            ),
            'tabs' => array(
                '#theme' => 'qt_ui_tabs_tabset',
                '#options' => array(
                    'active' => $active_tab,
                ),
                'tablinks' => $tabs,
            ),
            'divs' => array(),
        ),
    );
    foreach ($quickset->getContents() as $key => $tab) {
        if (!empty($tab)) {
            $attribs = array(
                'id' => 'qt-' . $qt_name . '-ui-tabs' . ($key + 1),
            );
            $render_array['content']['divs'][] = array(
                '#prefix' => '<div ' . drupal_attributes($attribs) . '>',
                '#suffix' => '</div>',
                'content' => $tab->render(),
            );
        }
    }
    return $render_array;
}