Same name in other branches
  1. 8.x-1.x src/QuickContent.php \Drupal\quicktabs\QuickContent::factory()

Instantiate a content type object.

Paramètres

$name: The type name of the plugin.

$item: An array containing the item definition

2 calls to QuickContent::factory()
QuickSet::getContentRenderer dans ./quicktabs.classes.inc
Returns a reference to an object that implements the QuickContentRenderable interface.
quick_content_factory dans ./quicktabs.module
Returns an object that implements the QuickContent interface.

Fichier

./quicktabs.classes.inc, line 427

Classe

QuickContent
Abstract base class for content plugins.

Code

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 (!module_exists($dep)) {
                    return NULL;
                }
            }
        }
        return new $class($item);
    }
    return NULL;
}