You are here

class QuickQtabsContent in Quick Tabs 7.3

Class for tab content of type "qtabs" - this is for rendering a QuickSet instance as the tab content of another QuickSet instance.

Hierarchy

Expanded class hierarchy of QuickQtabsContent

1 string reference to 'QuickQtabsContent'
quicktabs_quicktabs_contents in ./quicktabs.module
Implements hook_quicktabs_contents().

File

plugins/QuickQtabsContent.inc, line 7

View source
class QuickQtabsContent extends QuickContent {
  public static function getType() {
    return 'qtabs';
  }
  public function optionsForm($delta, $qt) {
    $tab = $this->settings;
    $form = array();
    $tab_options = array();
    foreach (quicktabs_load_multiple() as $machine_name => $info) {

      // Do not offer the option to put a tab inside itself.
      if (!isset($qt->machine_name) || $machine_name != $qt->machine_name) {
        $tab_options[$machine_name] = $info->title;
      }
    }
    $form['qtabs']['machine_name'] = array(
      '#type' => 'select',
      '#title' => t('Quicktabs instance'),
      '#description' => t('The Quicktabs instance to put inside this tab.'),
      '#options' => $tab_options,
      '#default_value' => isset($tab['machine_name']) ? $tab['machine_name'] : '',
    );
    return $form;
  }
  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'])) {
      if ($quicktabs = quicktabs_load($item['machine_name'])) {
        $contents = $quicktabs->tabs;
        $name = $quicktabs->machine_name;
        unset($quicktabs->tabs, $quicktabs->machine_name);
        $options = (array) $quicktabs;
        if ($qt = QuickSet::QuickSetRendererFactory($name, $contents, $quicktabs->renderer, $options)) {
          $output = $qt
            ->render();
        }
      }
    }
    $this->rendered_content = $output;
    return $output;
  }
  public function getAjaxKeys() {
    return array(
      'machine_name',
    );
  }
  public function getUniqueKeys() {
    return array(
      'machine_name',
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
QuickContent::$rendered_content protected property A render array of the contents.
QuickContent::$settings protected property An array containing the information that defines the tab content, specific to its type.
QuickContent::$title protected property Used as the title of the tab.
QuickContent::factory public static function Instantiate a content type object.
QuickContent::getSettings public function Accessor for the tab settings. Overrides QuickContentRenderable::getSettings
QuickContent::getTitle public function Accessor for the tab title. Overrides QuickContentRenderable::getTitle
QuickContent::__construct public function Constructor 2
QuickQtabsContent::getAjaxKeys public function Returns an array of keys to use for constructing the correct arguments for an ajax callback to retrieve content of this type. The order of the keys returned affects the order of the args passed in to the render method when called via ajax (see the… Overrides QuickContentRenderable::getAjaxKeys
QuickQtabsContent::getType public static function Returns the short type name of the content plugin, e.g. 'block', 'node', 'prerendered'. Overrides QuickContentRenderable::getType
QuickQtabsContent::getUniqueKeys public function Returns an array of keys, sufficient to represent the content uniquely. Overrides QuickContentRenderable::getUniqueKeys
QuickQtabsContent::optionsForm public function Method for returning the form elements to display for this tab type on the admin form. Overrides QuickContent::optionsForm
QuickQtabsContent::render public function Renders the content. Overrides QuickContentRenderable::render