Same name in other branches
  1. 7.x-3.x quicktabs.classes.inc \QuickSet::getActiveTab()

Returns the active tab for a given Quicktabs instance. This could be coming from the URL or just from the settings for this instance. If neither, it defaults to 0.

1 call to QuickSet::getActiveTab()
QuickSet::prepareContents in src/QuickSet.php
This method does some initial set-up of the tab contents, such as hiding tabs with no content if the hide_empty_tabs option is set. It also makes sure that prerendered contents are never attempted to be loaded via ajax.

File

src/QuickSet.php, line 248

Class

QuickSet
A QuickSet object is an unrendered Quicktabs instance, essentially just a container of content items, as defined by its configuration settings and the array of content items it contains.

Namespace

Drupal\quicktabs

Code

public function getActiveTab() {
    $active_tab = isset($this->settings['default_tab']) ? $this->settings['default_tab'] : key($this->contents);
    $active_tab = isset($_GET['qt-' . $this->name]) ? $_GET['qt-' . $this->name] : $active_tab;
    $active_tab = isset($active_tab) && isset($this->contents[$active_tab]) ? $active_tab : QUICKTABS_DELTA_NONE;
    return $active_tab;
}