Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176

This commit is contained in:
Pantheon Automation 2015-08-17 17:00:26 -07:00 committed by Greg Anderson
commit 9921556621
13277 changed files with 1459781 additions and 0 deletions

View file

@ -0,0 +1,39 @@
<?php
/**
* @file
* Contains \Drupal\Component\Plugin\Derivative\DeriverBase.
*/
namespace Drupal\Component\Plugin\Derivative;
/**
* Provides a basic deriver.
*/
abstract class DeriverBase implements DeriverInterface {
/**
* List of derivative definitions.
*
* @var array
*/
protected $derivatives = array();
/**
* {@inheritdoc}
*/
public function getDerivativeDefinition($derivative_id, $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];
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
return $this->derivatives;
}
}

View file

@ -0,0 +1,47 @@
<?php
/**
* @file
* Contains \Drupal\Component\Plugin\Derivative\DeriverInterface.
*/
namespace Drupal\Component\Plugin\Derivative;
/**
* Provides additional plugin definitions based on an existing definition.
*
* @ingroup plugin_api
*/
interface DeriverInterface {
/**
* Gets the definition of a derivative plugin.
*
* @param string $derivative_id
* The derivative id. The id must uniquely identify the derivative within a
* given base plugin, but derivative ids can be reused across base plugins.
* @param mixed $base_plugin_definition
* The definition of the base plugin from which the derivative plugin
* is derived. It is maybe an entire object or just some array, depending
* on the discovery mechanism.
*
* @return array
* The full definition array of the derivative plugin, typically a merge of
* $base_plugin_definition with extra derivative-specific information. NULL
* if the derivative doesn't exist.
*/
public function getDerivativeDefinition($derivative_id, $base_plugin_definition);
/**
* Gets the definition of all derivatives of a base plugin.
*
* @param array $base_plugin_definition
* The definition array of the base plugin.
* @return array
* An array of full derivative definitions keyed on derivative id.
*
* @see getDerivativeDefinition()
*/
public function getDerivativeDefinitions($base_plugin_definition);
}