Update to Drupal 8.0.0-rc3. For more information, see https://www.drupal.org/node/2608078

This commit is contained in:
Pantheon Automation 2015-11-04 11:11:27 -08:00 committed by Greg Anderson
parent 6419a031d7
commit 4afb23bbd3
762 changed files with 20080 additions and 6368 deletions

View file

@ -76,7 +76,7 @@ trait CategorizingPluginManagerTrait {
}
/**
* Implements \Drupal\Component\Plugin\CategorizingPluginManagerInterface::getCategories().
* {@inheritdoc}
*/
public function getCategories() {
/** @var \Drupal\Core\Plugin\CategorizingPluginManagerTrait|\Drupal\Component\Plugin\PluginManagerInterface $this */
@ -89,7 +89,7 @@ trait CategorizingPluginManagerTrait {
}
/**
* Implements \Drupal\Component\Plugin\CategorizingPluginManagerInterface::getSortedDefinitions().
* {@inheritdoc}
*/
public function getSortedDefinitions(array $definitions = NULL, $label_key = 'label') {
// Sort the plugins first by category, then by label.
@ -105,7 +105,7 @@ trait CategorizingPluginManagerTrait {
}
/**
* Implements \Drupal\Component\Plugin\CategorizingPluginManagerInterface::getGroupedDefinitions().
* {@inheritdoc}
*/
public function getGroupedDefinitions(array $definitions = NULL, $label_key = 'label') {
/** @var \Drupal\Core\Plugin\CategorizingPluginManagerTrait|\Drupal\Component\Plugin\PluginManagerInterface $this */

View file

@ -121,11 +121,9 @@ class Context extends ComponentContext implements ContextInterface {
if (!isset($this->contextData)) {
$definition = $this->getContextDefinition();
$default_value = $definition->getDefaultValue();
if (isset($default_value)) {
// Store the default value so that subsequent calls don't have to look
// it up again.
$this->contextData = $this->getTypedDataManager()->create($definition->getDataDefinition(), $default_value);
}
// Store the default value so that subsequent calls don't have to look
// it up again.
$this->contextData = $this->getTypedDataManager()->create($definition->getDataDefinition(), $default_value);
}
return $this->contextData;
}

View file

@ -53,7 +53,7 @@ trait ContextAwarePluginAssignmentTrait {
];
}
if (count($options) > 1) {
if (count($options) > 1 || !$definition->isRequired()) {
$assignments = $plugin->getContextMapping();
$element[$context_slot] = [
'#title' => $definition->getLabel() ?: $this->t('Select a @context value:', ['@context' => $context_slot]),
@ -63,6 +63,9 @@ trait ContextAwarePluginAssignmentTrait {
'#default_value' => !empty($assignments[$context_slot]) ? $assignments[$context_slot] : '',
'#description' => $definition->getDescription(),
];
if (!$definition->isRequired()) {
$element[$context_slot]['#empty_value'] = '';
}
}
}
return $element;

View file

@ -93,7 +93,7 @@ abstract class ContextAwarePluginBase extends ComponentContextAwarePluginBase im
public function setContextMapping(array $context_mapping) {
if ($this instanceof ConfigurablePluginInterface) {
$configuration = $this->getConfiguration();
$configuration['context_mapping'] = $context_mapping;
$configuration['context_mapping'] = array_filter($context_mapping);
$this->setConfiguration($configuration);
}
else {

View file

@ -31,11 +31,11 @@ interface ContextAwarePluginInterface extends ComponentContextAwarePluginInterfa
* @param string $name
* The name of the context in the plugin definition.
*
* @throws \Drupal\Component\Plugin\Exception\PluginException
* If the requested context is not defined.
*
* @return \Drupal\Core\Plugin\Context\ContextDefinitionInterface.
* The definition against which the context value must validate.
*
* @throws \Drupal\Component\Plugin\Exception\PluginException
* If the requested context is not defined.
*/
public function getContextDefinition($name);

View file

@ -8,13 +8,14 @@
namespace Drupal\Core\Plugin;
use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Cache\UseCacheBackendTrait;
use Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait;
use Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator;
use Drupal\Component\Plugin\PluginManagerBase;
use Drupal\Component\Plugin\PluginManagerInterface;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
use Drupal\Core\Plugin\Factory\ContainerFactory;
@ -27,13 +28,7 @@ use Drupal\Core\Plugin\Factory\ContainerFactory;
class DefaultPluginManager extends PluginManagerBase implements PluginManagerInterface, CachedDiscoveryInterface {
use DiscoveryCachedTrait;
/**
* Cache backend instance.
*
* @var \Drupal\Core\Cache\CacheBackendInterface
*/
protected $cacheBackend;
use UseCacheBackendTrait;
/**
* The cache key.
@ -80,13 +75,6 @@ class DefaultPluginManager extends PluginManagerBase implements PluginManagerInt
*/
protected $defaults = array();
/**
* Flag whether persistent caches should be used.
*
* @var bool
*/
protected $useCaches = TRUE;
/**
* The name of the annotation that contains the plugin definition.
*
@ -236,30 +224,6 @@ class DefaultPluginManager extends PluginManagerBase implements PluginManagerInt
}
}
/**
* Fetches from the cache backend, respecting the use caches flag.
*
* @see \Drupal\Core\Cache\CacheBackendInterface::get()
*/
protected function cacheGet($cid) {
if ($this->useCaches && $this->cacheBackend) {
return $this->cacheBackend->get($cid);
}
return FALSE;
}
/**
* Stores data in the persistent cache, respecting the use caches flag.
*
* @see \Drupal\Core\Cache\CacheBackendInterface::set()
*/
protected function cacheSet($cid, $data, $expire = Cache::PERMANENT, array $tags = array()) {
if ($this->cacheBackend && $this->useCaches) {
$this->cacheBackend->set($cid, $data, $expire, $tags);
}
}
/**
* Performs extra processing on plugin definitions.
*

View file

@ -47,7 +47,7 @@ class HookDiscovery implements DiscoveryInterface {
}
/**
* Implements Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinitions().
* {@inheritdoc}
*/
public function getDefinitions() {
$definitions = array();

View file

@ -45,7 +45,7 @@ class InfoHookDecorator implements DiscoveryInterface {
}
/**
* Implements Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinitions().
* {@inheritdoc}
*/
public function getDefinitions() {
$definitions = $this->decorated->getDefinitions();