2c2 < index 8bce755..cdc7818 100644 --- > index 05067ab598..6c0483a230 100644 5,6c5 < @@ -1653,4 +1653,6 @@ services: < response_filter.rss.relative_url: --- > @@ -1771,6 +1771,9 @@ services: 9c8 < - - { name: event_subscriber } --- > - { name: event_subscriber } 12a12,14 > messenger: > class: Drupal\Core\Messenger\Messenger > arguments: ['@session.flash_bag', '@page_cache_kill_switch'] 15c17 < index 0000000..9bd4328 --- > index 0000000000..9bd43281be 42c44 < index 0000000..2e79113 --- > index 0000000000..2e79113dd0 107c109 < index 0000000..50be9ec --- > index 0000000000..ef04680bfb 186c188 < + * return @array --- > + * @return array 191c193 < + public function massageOut($properties); --- > + public function massageOut(array $properties); 196c198 < index 0000000..527bb9e --- > index 0000000000..21f24b7b2d 223c225 < + protected $plugins = array(); --- > + protected $plugins = []; 237c239 < + parent::__construct('Plugin/DisplayComponent', $namespaces, $module_handler, 'Drupal\Core\Entity\DisplayComponentHandlerInterface' , 'Drupal\Core\Entity\Annotation\DisplayComponent'); --- > + parent::__construct('Plugin/DisplayComponent', $namespaces, $module_handler, 'Drupal\Core\Entity\DisplayComponentHandlerInterface', 'Drupal\Core\Entity\Annotation\DisplayComponent'); 257c259 < index cd90ecc..744deb7 100644 --- > index 3dcffd2cfa..918ac21ee2 100644 260,263c262,268 < @@ -129,33 +129,6 @@ public function __construct(array $values, $entity_type) { < /** < * {@inheritdoc} < */ --- > @@ -139,33 +139,6 @@ public function __construct(array $values, $entity_type) { > parent::__construct($values, $entity_type); > } > > - /** > - * {@inheritdoc} > - */ 271c276 < - $widget = $this->pluginManager->getInstance(array( --- > - $widget = $this->pluginManager->getInstance([ 276,277c281,282 < - 'configuration' => $configuration < - )); --- > - 'configuration' => $configuration, > - ]); 288,293c293,295 < - /** < - * {@inheritdoc} < - */ < public function buildForm(FieldableEntityInterface $entity, array &$form, FormStateInterface $form_state) { < // Set #parents to 'top-level' by default. < $form += array('#parents' => array()); --- > /** > * {@inheritdoc} > */ 295c297 < index b6c73e5..053f661 100644 --- > index ee07817187..0aa6181b3f 100644 298,299c300,302 < @@ -79,6 +79,11 @@ < protected $hidden = array(); --- > @@ -78,6 +78,13 @@ abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDispl > */ > protected $hidden = []; 301c304 < /** --- > + /** 302a306,307 > + * > + * @var array 304c309 < + protected $renderers = array(); --- > + protected $renderers = []; 306c311 < + /** --- > /** 309,310c314,315 < * < @@ -115,6 +120,18 @@ --- > @@ -114,6 +121,18 @@ abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDispl > */ 313c318 < /** --- > + /** 325c330 < + /** --- > /** 328,329c333 < public function __construct(array $values, $entity_type) { < @@ -138,6 +155,8 @@ public function __construct(array $values, $entity_type) { --- > @@ -138,6 +157,8 @@ public function __construct(array $values, $entity_type) { 338c342 < @@ -321,13 +340,14 @@ public function calculateDependencies() { --- > @@ -296,13 +317,14 @@ public function calculateDependencies() { 360c364 < @@ -366,16 +386,20 @@ public function setComponent($name, array $options = array()) { --- > @@ -341,16 +363,20 @@ public function setComponent($name, array $options = []) { 384c388 < @@ -595,4 +619,69 @@ protected function getLogger() { --- > @@ -571,4 +597,71 @@ protected function getLogger() { 392c396 < + * The element name. --- > + * The name of the element. 394a399 > + * The display component handler. 418a424 > + * The display component handler. 421c427 < + $handler = $this->handlerManager->getInstance(array('type' => $type)); --- > + $handler = $this->handlerManager->getInstance(['type' => $type]); 423c429 < + $handler->setContext(array( --- > + $handler->setContext([ 428c434 < + )); --- > + ]); 433c439 < + /**+ --- > + /** 455c461 < index 1b3e6c0..4c7f7e4 100644 --- > index 2ff43fcb16..9da338c096 100644 458c464,494 < @@ -465,6 +465,12 @@ protected function getSingleFieldDisplay($entity, $field_name, $display_options) --- > @@ -80,6 +80,20 @@ class EntityViewBuilder extends EntityHandlerBase implements EntityHandlerInterf > */ > protected $singleFieldDisplays; > > + /** > + * The entity field manager. > + * > + * @var \Drupal\Core\Entity\EntityFieldManagerInterface > + */ > + protected $entityFieldManager; > + > + /** > + * The entity field manager. > + * > + * @var \Drupal\Core\Field\FormatterPluginManager > + */ > + protected $formatterPluginManager; > + > /** > * Constructs a new EntityViewBuilder. > * > @@ -101,6 +115,8 @@ public function __construct(EntityTypeInterface $entity_type, EntityRepositoryIn > $this->languageManager = $language_manager; > $this->themeRegistry = $theme_registry; > $this->entityDisplayRepository = $entity_display_repository; > + $this->entityFieldManager = \Drupal::service('entity_field.manager'); > + $this->formatterPluginManager = \Drupal::service('plugin.manager.field.formatter'); > } > > /** > @@ -523,6 +539,10 @@ protected function getSingleFieldDisplay($entity, $field_name, $display_options) 462,463c498 < + < + $definitions = $this->entityManager->getBaseFieldDefinitions($entity_type_id); --- > + $definitions = $this->entityFieldManager->getBaseFieldDefinitions($entity_type_id); 465c500 < + $display_options = \Drupal::service('plugin.manager.field.formatter')->prepareConfiguration($definitions[$field_name]->getType(), $display_options); --- > + $display_options = $this->formatterPluginManager->prepareConfiguration($definitions[$field_name]->getType(), $display_options); 467,468c502 < + < $this->singleFieldDisplays[$key] = EntityViewDisplay::create(array( --- > $this->singleFieldDisplays[$key] = EntityViewDisplay::create([ 473c507 < index 0000000..755e377 --- > index 0000000000..171d6b3406 476c510 < @@ -0,0 +1,54 @@ --- > @@ -0,0 +1,93 @@ 481a516,518 > +use Drupal\Core\Entity\EntityFieldManagerInterface; > +use Drupal\Core\Plugin\ContainerFactoryPluginInterface; > +use Symfony\Component\DependencyInjection\ContainerInterface; 490c527,563 < +class ExtraFieldDisplayComponentHandler extends DisplayComponentHandlerBase { --- > +class ExtraFieldDisplayComponentHandler extends DisplayComponentHandlerBase implements ContainerFactoryPluginInterface { > + > + /** > + * The entity field manager. > + * > + * @var \Drupal\Core\Entity\EntityFieldManagerInterface > + */ > + protected $entityFieldManager; > + > + /** > + * Constructs a FieldDisplayComponentHandler object. > + * > + * @param array $configuration > + * A configuration array containing information about the plugin instance. > + * @param string $plugin_id > + * The plugin ID for the plugin instance. > + * @param array $plugin_definition > + * The plugin implementation definition. > + * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager > + * The entity field manager. > + */ > + public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityFieldManagerInterface $entity_field_manager) { > + parent::__construct($configuration, $plugin_id, $plugin_definition); > + $this->entityFieldManager = $entity_field_manager; > + } > + > + /** > + * {@inheritdoc} > + */ > + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { > + return new static( > + $configuration, > + $plugin_id, > + $plugin_definition, > + $container->get('entity_field.manager') > + ); > + } 502,504c575,577 < + $components[$name] = array( < + 'weight' => $definition['weight'] < + ); --- > + $components[$name] = [ > + 'weight' => $definition['weight'], > + ]; 526,527c599,600 < + $extra_fields = \Drupal::entityManager()->getExtraFields($this->context['entity_type'], $this->context['bundle']); < + return isset($extra_fields[$context]) ? $extra_fields[$context] : array(); --- > + $extra_fields = $this->entityFieldManager->getExtraFields($this->context['entity_type'], $this->context['bundle']); > + return $extra_fields[$context] ?? []; 533c606 < index 0000000..df029d9 --- > index 0000000000..6dd3a89ecf 541c614,615 < +use Drupal\Core\Entity\EntityManagerInterface; --- > +use Drupal\Core\Entity\DisplayComponentHandlerBase; > +use Drupal\Core\Entity\EntityFieldManagerInterface; 546d619 < +use Drupal\Core\Entity\DisplayComponentHandlerBase; 573c646 < + * The entity manager. --- > + * The entity field manager. 575c648 < + * @var \Drupal\Core\Entity\EntityManagerInterface --- > + * @var \Drupal\Core\Entity\EntityFieldManagerInterface 577,578c650 < + protected $entityManager; < + --- > + protected $entityFieldManager; 592a665,666 > + * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager > + * The entity field manager. 594c668 < + public function __construct(array $configuration, $plugin_id, array $plugin_definition, FormatterPluginManager $formatter_plugin_manager, WidgetPluginManager $widget_plugin_manager, EntityManagerInterface $entity_manager) { --- > + public function __construct(array $configuration, $plugin_id, array $plugin_definition, FormatterPluginManager $formatter_plugin_manager, WidgetPluginManager $widget_plugin_manager, EntityFieldManagerInterface $entity_field_manager) { 596d669 < + 599c672 < + $this->entityManager = $entity_manager; --- > + $this->entityFieldManager = $entity_field_manager; 609c682 < + $container->get('entity.manager') --- > + $container->get('entity_field.manager') 690c763 < + return $plugin_manager->getInstance(array( --- > + return $plugin_manager->getInstance([ 697c770 < + )); --- > + ]); 715c788 < + return isset($definitions[$field_name]) ? $definitions[$field_name] : NULL; --- > + return $definitions[$field_name] ?? NULL; 725c798 < + $definitions = $this->entityManager->getFieldDefinitions($entity_type, $bundle); --- > + $definitions = $this->entityFieldManager->getFieldDefinitions($entity_type, $bundle); 736c809 < index 9f6ef8b..bda7740 100644 --- > index deb6a75e29..0c54dbbcc0 100644 739c812,813 < @@ -2017,5 +2017,20 @@ function hook_entity_extra_field_info_alter(&$info) { --- > @@ -2255,6 +2255,21 @@ function hook_entity_extra_field_info_alter(&$info) { > } 742c816 < /** --- > +/** 748c822 < + * @param $plugins --- > + * @param string[] $plugins 754c828 < + $plugins['someplugin']['label'] = t('Better name'); --- > + $plugins['some_plugin']['label'] = t('Better name'); 757c831 < +/** --- > /** 761c835 < index ca9bd06..65e1d3a 100644 --- > index c4df0f5f2f..70a4313e30 100644 764c838 < @@ -56,6 +56,12 @@ public function createInstance($plugin_id, array $configuration = array()) { --- > @@ -56,6 +56,12 @@ public function createInstance($plugin_id, array $configuration = []) { 768c842 < + // @TODO, is this missing somewhere else? --- > + // @todo is this missing somewhere else?