Same name in other branches
  1. 8.x-1.x src/QuickPreRenderedContent.php \Drupal\quicktabs\QuickPreRenderedContent

This class implements the same interface that content plugins do but it is not a content plugin. It is a special class for pre-rendered content which is used when "custom" tabs are added to existing Quicktabs instances in a call to quicktabs_build_quicktabs().

Hierarchy

Expanded class hierarchy of QuickPreRenderedContent

Fichier

./quicktabs.classes.inc, line 464

View source
class QuickPreRenderedContent implements QuickContentRenderable {
    public static function getType() {
        return 'prerendered';
    }
    
    /**
     * Used as the title of the tab.
     * @var title
     */
    protected $title;
    
    /**
     * A render array of the contents.
     * @var array
     */
    protected $rendered_content;
    
    /**
     * An array containing the information that defines the tab content, specific
     * to its type.
     * @var array
     */
    protected $settings;
    
    /**
     * Constructor
     */
    public function __construct($item) {
        $contents = isset($item['contents']) ? $item['contents'] : array();
        if (!is_array($contents)) {
            $contents = array(
                '#markup' => $contents,
            );
        }
        $this->rendered_content = $contents;
        $this->title = isset($item['title']) ? $item['title'] : '';
        unset($item['title'], $item['contents']);
        $this->settings = $item;
    }
    
    /**
     * Accessor for the tab title.
     */
    public function getTitle() {
        return $this->title;
    }
    
    /**
     * Accessor for the tab settings.
     */
    public function getSettings() {
        return $this->settings;
    }
    
    /**
     * The render method simply returns the contents that were passed in and
     * stored during construction.
     */
    public function render($hide_empty = FALSE, $args = array()) {
        return $this->rendered_content;
    }
    
    /**
     * This content cannot be rendered via ajax so we don't return any ajax keys.
     */
    public function getAjaxKeys() {
        return array();
    }
    public function getUniqueKeys() {
        return array(
            'class_suffix',
        );
    }

}

Members

Titre Trier par ordre décroissant Modifiers Object type Résumé Overriden Title
QuickPreRenderedContent::$rendered_content protected property A render array of the contents.
QuickPreRenderedContent::$settings protected property An array containing the information that defines the tab content, specific
to its type.
QuickPreRenderedContent::$title protected property Used as the title of the tab.
QuickPreRenderedContent::getAjaxKeys public function This content cannot be rendered via ajax so we don't return any ajax keys. Overrides QuickContentRenderable::getAjaxKeys
QuickPreRenderedContent::getSettings public function Accessor for the tab settings. Overrides QuickContentRenderable::getSettings
QuickPreRenderedContent::getTitle public function Accessor for the tab title. Overrides QuickContentRenderable::getTitle
QuickPreRenderedContent::getType public static function Returns the short type name of the content plugin, e.g. 'block', 'node',
'prerendered'.
Overrides QuickContentRenderable::getType
QuickPreRenderedContent::getUniqueKeys public function Returns an array of keys, sufficient to represent the content uniquely. Overrides QuickContentRenderable::getUniqueKeys
QuickPreRenderedContent::render public function The render method simply returns the contents that were passed in and
stored during construction.
Overrides QuickContentRenderable::render
QuickPreRenderedContent::__construct public function Constructor