Same name and namespace in other branches
  1. 7.x-3.x quicktabs.classes.inc \QuickContent

Abstract base class for content plugins.

Hierarchy

Expanded class hierarchy of QuickContent

6 files declare their use of QuickContent
QuickBlockContent.php in src/Plugin/QuickContent/QuickBlockContent.php
Contains Drupal\quicktabs\Plugin\QuickContent\QuickBlockContent.php.
QuickCallbackContent.php in src/Plugin/QuickContent/QuickCallbackContent.php
Contains \Drupal\quicktabs\Plugin\QuickContent\QuickCallbackContent.php
QuickNodeContent.php in src/Plugin/QuickContent/QuickNodeContent.php
Contains \Drupal\quicktabs\Plugin\QuickContent\QuickNodeContent.
QuickQtabsContent.php in src/Plugin/QuickContent/QuickQtabsContent.php
Contains Drupal\quicktabs\Plugin\QuickContent\QuickQtabsContent.php
quicktabs.module in ./quicktabs.module

... See full list

File

src/QuickContent.php, line 9

Namespace

Drupal\quicktabs
View source
abstract class QuickContent implements QuickContentRenderableInterface {
    
    /**
     * Used as the title of the tab.
     * @var string
     */
    protected $title;
    
    /**
     * An array containing the information that defines the tab content, specific
     * to its type.
     * @var array
     */
    protected $settings;
    
    /**
     * A render array of the contents.
     * @var array
     */
    protected $rendered_content;
    
    /**
     * Constructor
     */
    public function __construct($item) {
        $this->title = isset($item['title']) ? $item['title'] : '';
        // We do not need to store title, type or weight in the settings array, which
        // is for type-specific settings.
        unset($item['title'], $item['type'], $item['weight']);
        $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;
    }
    
    /**
     * Instantiate a content type object.
     *
     * @param $name
     *   The type name of the plugin.
     *
     * @param $item
     *   An array containing the item definition
     *
     */
    public static function factory($name, $item) {
        ctools_include('plugins');
        if ($class = ctools_plugin_load_class('quicktabs', 'contents', $name, 'handler')) {
            // We now need to check the plugin's dependencies, to make sure they're installed.
            // This info has already been statically cached at this point so there's no
            // harm in making a call to ctools_get_plugins().
            $plugin = ctools_get_plugins('quicktabs', 'contents', $name);
            if (isset($plugin['dependencies'])) {
                foreach ($plugin['dependencies'] as $dep) {
                    // If any dependency is missing we cannot instantiate our class.
                    if (!Drupal::moduleHandler()->moduleExists($dep)) {
                        return NULL;
                    }
                }
            }
            return new $class($item);
        }
        return NULL;
    }
    
    /**
     * Method for returning the form elements to display for this tab type on
     * the admin form.
     *
     * @param $delta Integer representing this tab's position in the tabs array.
     *
     * @param $qt An object representing the Quicktabs instance that the tabs are
     * being built for.
     */
    public abstract function optionsForm($delta, $qt);

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title 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 QuickContentRenderableInterface::getSettings
QuickContent::getTitle public function Accessor for the tab title. Overrides QuickContentRenderableInterface::getTitle
QuickContent::optionsForm abstract public function Method for returning the form elements to display for this tab type on
the admin form.
5
QuickContent::__construct public function Constructor 2
QuickContentRenderableInterface::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ā€¦
6
QuickContentRenderableInterface::getType public static function Returns the short type name of the content plugin, e.g. 'block', 'node',
'prerendered'.
6
QuickContentRenderableInterface::getUniqueKeys public function Returns an array of keys, sufficient to represent the content uniquely. 6
QuickContentRenderableInterface::render public function Renders the content. 6