Mercurial > hg > isophonics-drupal-site
diff core/modules/field_ui/src/Access/ViewModeAccessCheck.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line diff
--- a/core/modules/field_ui/src/Access/ViewModeAccessCheck.php Thu Feb 28 13:21:36 2019 +0000 +++ b/core/modules/field_ui/src/Access/ViewModeAccessCheck.php Thu May 09 15:33:08 2019 +0100 @@ -3,7 +3,8 @@ namespace Drupal\field_ui\Access; use Drupal\Core\Access\AccessResult; -use Drupal\Core\Entity\EntityManagerInterface; +use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait; +use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Routing\Access\AccessInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; @@ -15,22 +16,28 @@ * @see \Drupal\Core\Entity\Entity\EntityViewMode */ class ViewModeAccessCheck implements AccessInterface { + use DeprecatedServicePropertyTrait; /** - * The entity manager. + * {@inheritdoc} + */ + protected $deprecatedProperties = ['entityManager' => 'entity.manager']; + + /** + * The entity type manager. * - * @var \Drupal\Core\Entity\EntityManagerInterface + * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ - protected $entityManager; + protected $entityTypeManager; /** * Creates a new ViewModeAccessCheck. * - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager - * The entity manager. + * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager + * The entity type manager. */ - public function __construct(EntityManagerInterface $entity_manager) { - $this->entityManager = $entity_manager; + public function __construct(EntityTypeManagerInterface $entity_type_manager) { + $this->entityTypeManager = $entity_type_manager; } /** @@ -60,7 +67,7 @@ $access = AccessResult::neutral(); if ($entity_type_id = $route->getDefault('entity_type_id')) { if (empty($bundle)) { - $entity_type = $this->entityManager->getDefinition($entity_type_id); + $entity_type = $this->entityTypeManager->getDefinition($entity_type_id); $bundle = $route_match->getRawParameter($entity_type->getBundleEntityType()); } @@ -68,7 +75,7 @@ if ($view_mode_name == 'default') { $visibility = TRUE; } - elseif ($entity_display = $this->entityManager->getStorage('entity_view_display')->load($entity_type_id . '.' . $bundle . '.' . $view_mode_name)) { + elseif ($entity_display = $this->entityTypeManager->getStorage('entity_view_display')->load($entity_type_id . '.' . $bundle . '.' . $view_mode_name)) { $visibility = $entity_display->status(); }