class GridBuilder in Grid builder 8
GridBuilder plugin derivative definition.
Hierarchy
- class \Drupal\gridbuilder\Plugin\Derivative\GridBuilder implements \Drupal\Component\Plugin\Derivative\DerivativeInterface
Expanded class hierarchy of GridBuilder
File
- lib/
Drupal/ gridbuilder/ Plugin/ Derivative/ GridBuilder.php, line 15 - Definition of Drupal\gridbuilder\Plugin\Derivative\GridBuilder.
Namespace
Drupal\gridbuilder\Plugin\DerivativeView source
class GridBuilder implements DerivativeInterface {
/**
* List of derivatives.
*
* Associative array keyed by grid config key name. The values of the array are
* associative arrays themselves with metadata about the grid.
*
* @var array
*/
protected $derivatives = array();
/**
* Implements DerivativeInterface::getDerivativeDefinition().
*/
public function getDerivativeDefinition($derivative_id, array $base_plugin_definition) {
if (!empty($this->derivatives) && !empty($this->derivatives[$derivative_id])) {
return $this->derivatives[$derivative_id];
}
$this
->getDerivativeDefinitions($base_plugin_definition);
return $this->derivatives[$derivative_id];
}
/**
* Implements DerivativeInterface::getDerivativeDefinitions().
*/
public function getDerivativeDefinitions(array $base_plugin_definition) {
// Use module_invoke() because plugins are active even if the module is not
// enabled.
$this->derivatives = array();
$grids = module_invoke('gridbuilder', 'load_all');
if (!empty($grids)) {
foreach ($grids as $key => $grid) {
$this->derivatives[$key] = array(
'grid' => $grid,
'class' => 'Drupal\\gridbuilder\\Plugin\\gridbuilder\\gridbuilder\\EqualColumnGrid',
);
}
}
return $this->derivatives;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
GridBuilder:: |
protected | property | List of derivatives. | |
GridBuilder:: |
public | function | Implements DerivativeInterface::getDerivativeDefinition(). | |
GridBuilder:: |
public | function | Implements DerivativeInterface::getDerivativeDefinitions(). |