diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php b/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php index 6eef193..119b5c5 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php @@ -207,7 +207,7 @@ public function settingsForm(array $form, array &$form_state) { '#type' => 'select', '#title' => $this->t('Pager ID'), '#options' => range(0, 10), - '#default_value' => empty($this->settings['pager_id']) ? 0 : $this->settings['pager_id'], + '#default_value' => $this->getSetting('pager_id'), '#description' => $this->t("Unless you're experiencing problems with pagers related to this field, you should leave this at 0. If using multiple pagers on one page you may need to set this number to a higher value so as not to conflict within the ?page= array. Large values will add a lot of commas to your URLs, so avoid if possible."), ); return $element; @@ -218,9 +218,9 @@ public function settingsForm(array $form, array &$form_state) { */ public function settingsSummary() { // Only show a summary if we're using a non-standard pager id. - if (!empty($this->settings['pager_id'])) { + if ($this->getSetting('pager_id')) { return array($this->t('Pager ID: @id', array( - '@id' => $this->settings['pager_id'], + '@id' => $this->getSetting('pager_id'), ))); } return array(); diff --git a/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php index 326237b..d09cdeb 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php +++ b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php @@ -166,7 +166,7 @@ public function calculateDependencies() { // Create a dependency on the module that provides the formatter or // widget. if (isset($component['type'])) { - $definition = $this->pluginManager->getDefinition($component['type']); + $definition = $this->getRenderer($field_name)->getPluginDefinition(); $this->addDependency('module', $definition['provider']); } } diff --git a/core/modules/entity/lib/Drupal/entity/Plugin/Type/DisplayComponentHandlerPluginManager.php b/core/modules/entity/lib/Drupal/entity/Plugin/Type/DisplayComponentHandlerPluginManager.php index 1081065..1547a3f 100644 --- a/core/modules/entity/lib/Drupal/entity/Plugin/Type/DisplayComponentHandlerPluginManager.php +++ b/core/modules/entity/lib/Drupal/entity/Plugin/Type/DisplayComponentHandlerPluginManager.php @@ -22,41 +22,41 @@ */ class DisplayComponentHandlerPluginManager extends DefaultPluginManager { - /** - * The handlers that have already been instantiated by getInstance(). - * - * @var array - */ - protected $plugins = array(); + /** + * The handlers that have already been instantiated by getInstance(). + * + * @var array + */ + protected $plugins = array(); - /** - * Constructs a DisplayComponentHandlerPluginManager object. - * - * @param \Traversable $namespaces - * An object that implements \Traversable which contains the root paths - * keyed by the corresponding namespace to look for plugin implementations. - * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend - * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The module handler to invoke the alter hook with. - */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { - parent::__construct('Plugin/DisplayComponent', $namespaces, 'Drupal\entity\Annotation\DisplayComponent'); - // @todo Document the alter hook. - $this->alterInfo($module_handler, 'display_component_handler_info'); - $this->setCacheBackend($cache_backend, $language_manager, 'display_component_handlers'); - } + /** + * Constructs a DisplayComponentHandlerPluginManager object. + * + * @param \Traversable $namespaces + * An object that implements \Traversable which contains the root paths + * keyed by the corresponding namespace to look for plugin implementations. + * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend + * Cache backend instance to use. + * @param \Drupal\Core\Language\LanguageManager $language_manager + * The language manager. + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler + * The module handler to invoke the alter hook with. + */ + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { + parent::__construct('Plugin/DisplayComponent', $namespaces, $module_handler, 'Drupal\entity\Annotation\DisplayComponent'); + // @todo Document the alter hook. + $this->alterInfo('display_component_handler_info'); + $this->setCacheBackend($cache_backend, $language_manager, 'display_component_handlers'); + } - /** - * {@inheritdoc} - */ - public function getInstance(array $options) { - $plugin_id = $options['type']; + /** + * {@inheritdoc} + */ + public function getInstance(array $options) { + $plugin_id = $options['type']; - if (!isset($this->plugins[$plugin_id]) && !array_key_exists($plugin_id, $this->plugins)) { - $this->plugins[$plugin_id] = $this->discovery->getDefinition($plugin_id) ? $this->createInstance($plugin_id) : NULL; + if (!isset($this->plugins[$plugin_id]) && !array_key_exists($plugin_id, $this->plugins)) { + $this->plugins[$plugin_id] = $this->discovery->getDefinition($plugin_id) ? $this->createInstance($plugin_id) : NULL; } return $this->plugins[$plugin_id];