Mercurial > hg > cmmr2012-drupal-site
comparison core/lib/Drupal/Core/Entity/EntityDisplayBase.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | a9cd425dd02b |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
287 /** | 287 /** |
288 * {@inheritdoc} | 288 * {@inheritdoc} |
289 */ | 289 */ |
290 public function calculateDependencies() { | 290 public function calculateDependencies() { |
291 parent::calculateDependencies(); | 291 parent::calculateDependencies(); |
292 $target_entity_type = $this->entityManager()->getDefinition($this->targetEntityType); | 292 $target_entity_type = $this->entityTypeManager()->getDefinition($this->targetEntityType); |
293 | 293 |
294 // Create dependency on the bundle. | 294 // Create dependency on the bundle. |
295 $bundle_config_dependency = $target_entity_type->getBundleConfigDependency($this->bundle); | 295 $bundle_config_dependency = $target_entity_type->getBundleConfigDependency($this->bundle); |
296 $this->addDependency($bundle_config_dependency['type'], $bundle_config_dependency['name']); | 296 $this->addDependency($bundle_config_dependency['type'], $bundle_config_dependency['name']); |
297 | 297 |
298 // If field.module is enabled, add dependencies on 'field_config' entities | 298 // If field.module is enabled, add dependencies on 'field_config' entities |
299 // for both displayed and hidden fields. We intentionally leave out base | 299 // for both displayed and hidden fields. We intentionally leave out base |
300 // field overrides, since the field still exists without them. | 300 // field overrides, since the field still exists without them. |
301 if (\Drupal::moduleHandler()->moduleExists('field')) { | 301 if (\Drupal::moduleHandler()->moduleExists('field')) { |
302 $components = $this->content + $this->hidden; | 302 $components = $this->content + $this->hidden; |
303 $field_definitions = $this->entityManager()->getFieldDefinitions($this->targetEntityType, $this->bundle); | 303 $field_definitions = \Drupal::service('entity_field.manager')->getFieldDefinitions($this->targetEntityType, $this->bundle); |
304 foreach (array_intersect_key($field_definitions, $components) as $field_name => $field_definition) { | 304 foreach (array_intersect_key($field_definitions, $components) as $field_name => $field_definition) { |
305 if ($field_definition instanceof ConfigEntityInterface && $field_definition->getEntityTypeId() == 'field_config') { | 305 if ($field_definition instanceof ConfigEntityInterface && $field_definition->getEntityTypeId() == 'field_config') { |
306 $this->addDependency('config', $field_definition->getConfigDependencyName()); | 306 $this->addDependency('config', $field_definition->getConfigDependencyName()); |
307 } | 307 } |
308 } | 308 } |
309 } | 309 } |
310 | 310 |
311 // Depend on configured modes. | 311 // Depend on configured modes. |
312 if ($this->mode != 'default') { | 312 if ($this->mode != 'default') { |
313 $mode_entity = $this->entityManager()->getStorage('entity_' . $this->displayContext . '_mode')->load($target_entity_type->id() . '.' . $this->mode); | 313 $mode_entity = $this->entityTypeManager()->getStorage('entity_' . $this->displayContext . '_mode')->load($target_entity_type->id() . '.' . $this->mode); |
314 $this->addDependency('config', $mode_entity->getConfigDependencyName()); | 314 $this->addDependency('config', $mode_entity->getConfigDependencyName()); |
315 } | 315 } |
316 return $this; | 316 return $this; |
317 } | 317 } |
318 | 318 |