Loading core/modules/comment/src/CommentBreadcrumbBuilder.php +5 −5 Original line number Diff line number Diff line Loading @@ -16,11 +16,11 @@ class CommentBreadcrumbBuilder implements BreadcrumbBuilderInterface { use StringTranslationTrait; /** * The comment storage. * The entity type manager. * * @var \Drupal\Core\Entity\EntityStorageInterface * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $storage; protected $entityTypeManager; /** * Constructs the CommentBreadcrumbBuilder. Loading @@ -29,7 +29,7 @@ class CommentBreadcrumbBuilder implements BreadcrumbBuilderInterface { * The entity type manager. */ public function __construct(EntityTypeManagerInterface $entity_type_manager) { $this->storage = $entity_type_manager->getStorage('comment'); $this->entityTypeManager = $entity_type_manager; } /** Loading @@ -51,7 +51,7 @@ public function build(RouteMatchInterface $route_match) { $breadcrumb->addLink(new Link($entity->label(), $entity->toUrl())); $breadcrumb->addCacheableDependency($entity); if (($pid = $route_match->getParameter('pid')) && ($comment = $this->storage->load($pid))) { if (($pid = $route_match->getParameter('pid')) && ($comment = $this->entityTypeManager->getStorage('comment')->load($pid))) { /** @var \Drupal\comment\CommentInterface $comment */ $breadcrumb->addCacheableDependency($comment); // Display link to parent comment. Loading core/modules/node/src/Plugin/views/row/Rss.php +1 −29 Original line number Diff line number Diff line Loading @@ -2,8 +2,6 @@ namespace Drupal\node\Plugin\views\row; use Drupal\Core\Entity\EntityDisplayRepositoryInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\views\Plugin\views\row\RssPluginBase; /** Loading Loading @@ -35,32 +33,6 @@ class Rss extends RssPluginBase { */ protected $entityTypeId = 'node'; /** * The node storage. * * @var \Drupal\node\NodeStorageInterface */ protected $nodeStorage; /** * Constructs the Rss 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 mixed $plugin_definition * The plugin implementation definition. * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager * The entity type manager. * @param \Drupal\Core\Entity\EntityDisplayRepositoryInterface $entity_display_repository * The entity display repository. */ public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, EntityDisplayRepositoryInterface $entity_display_repository = NULL) { parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $entity_display_repository); $this->nodeStorage = $entity_type_manager->getStorage('node'); } /** * {@inheritdoc} */ Loading @@ -82,7 +54,7 @@ public function preRender($values) { $nids[] = $row->{$this->field_alias}; } if (!empty($nids)) { $this->nodes = $this->nodeStorage->loadMultiple($nids); $this->nodes = $this->entityTypeManager->getStorage('node')->loadMultiple($nids); } } Loading core/modules/taxonomy/src/TermBreadcrumbBuilder.php +1 −9 Original line number Diff line number Diff line Loading @@ -30,13 +30,6 @@ class TermBreadcrumbBuilder implements BreadcrumbBuilderInterface { */ protected $entityTypeManager; /** * The taxonomy storage. * * @var \Drupal\taxonomy\TermStorageInterface */ protected $termStorage; /** * Constructs the TermBreadcrumbBuilder. * Loading @@ -47,7 +40,6 @@ class TermBreadcrumbBuilder implements BreadcrumbBuilderInterface { */ public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityRepositoryInterface $entity_repository) { $this->entityTypeManager = $entity_type_manager; $this->termStorage = $entity_type_manager->getStorage('taxonomy_term'); $this->entityRepository = $entity_repository; } Loading @@ -73,7 +65,7 @@ public function build(RouteMatchInterface $route_match) { // @todo This overrides any other possible breadcrumb and is a pure // hard-coded presumption. Make this behavior configurable per // vocabulary or term. $parents = $this->termStorage->loadAllParents($term->id()); $parents = $this->entityTypeManager->getStorage('taxonomy_term')->loadAllParents($term->id()); // Remove current term being accessed. array_shift($parents); foreach (array_reverse($parents) as $term) { Loading core/modules/taxonomy/taxonomy.tokens.inc +8 −4 Original line number Diff line number Diff line Loading @@ -95,7 +95,6 @@ function taxonomy_tokens($type, $tokens, array $data, array $options, Bubbleable $token_service = \Drupal::token(); $replacements = []; $taxonomy_storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term'); if ($type == 'term' && !empty($data['term'])) { $term = $data['term']; Loading Loading @@ -134,6 +133,7 @@ function taxonomy_tokens($type, $tokens, array $data, array $options, Bubbleable break; case 'parent': $taxonomy_storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term'); if ($parents = $taxonomy_storage->loadParents($term->id())) { $parent = array_pop($parents); $bubbleable_metadata->addCacheableDependency($parent); Loading @@ -148,11 +148,14 @@ function taxonomy_tokens($type, $tokens, array $data, array $options, Bubbleable $replacements += $token_service->generate('vocabulary', $vocabulary_tokens, ['vocabulary' => $vocabulary], $options, $bubbleable_metadata); } if (($vocabulary_tokens = $token_service->findWithPrefix($tokens, 'parent')) && $parents = $taxonomy_storage->loadParents($term->id())) { if (($vocabulary_tokens = $token_service->findWithPrefix($tokens, 'parent'))) { $taxonomy_storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term'); if ($parents = $taxonomy_storage->loadParents($term->id())) { $parent = array_pop($parents); $replacements += $token_service->generate('term', $vocabulary_tokens, ['term' => $parent], $options, $bubbleable_metadata); } } } elseif ($type == 'vocabulary' && !empty($data['vocabulary'])) { $vocabulary = $data['vocabulary']; Loading Loading @@ -182,6 +185,7 @@ function taxonomy_tokens($type, $tokens, array $data, array $options, Bubbleable break; case 'node-count': $taxonomy_storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term'); $replacements[$original] = $taxonomy_storage->nodeCount($vocabulary->id()); break; } Loading Loading
core/modules/comment/src/CommentBreadcrumbBuilder.php +5 −5 Original line number Diff line number Diff line Loading @@ -16,11 +16,11 @@ class CommentBreadcrumbBuilder implements BreadcrumbBuilderInterface { use StringTranslationTrait; /** * The comment storage. * The entity type manager. * * @var \Drupal\Core\Entity\EntityStorageInterface * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $storage; protected $entityTypeManager; /** * Constructs the CommentBreadcrumbBuilder. Loading @@ -29,7 +29,7 @@ class CommentBreadcrumbBuilder implements BreadcrumbBuilderInterface { * The entity type manager. */ public function __construct(EntityTypeManagerInterface $entity_type_manager) { $this->storage = $entity_type_manager->getStorage('comment'); $this->entityTypeManager = $entity_type_manager; } /** Loading @@ -51,7 +51,7 @@ public function build(RouteMatchInterface $route_match) { $breadcrumb->addLink(new Link($entity->label(), $entity->toUrl())); $breadcrumb->addCacheableDependency($entity); if (($pid = $route_match->getParameter('pid')) && ($comment = $this->storage->load($pid))) { if (($pid = $route_match->getParameter('pid')) && ($comment = $this->entityTypeManager->getStorage('comment')->load($pid))) { /** @var \Drupal\comment\CommentInterface $comment */ $breadcrumb->addCacheableDependency($comment); // Display link to parent comment. Loading
core/modules/node/src/Plugin/views/row/Rss.php +1 −29 Original line number Diff line number Diff line Loading @@ -2,8 +2,6 @@ namespace Drupal\node\Plugin\views\row; use Drupal\Core\Entity\EntityDisplayRepositoryInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\views\Plugin\views\row\RssPluginBase; /** Loading Loading @@ -35,32 +33,6 @@ class Rss extends RssPluginBase { */ protected $entityTypeId = 'node'; /** * The node storage. * * @var \Drupal\node\NodeStorageInterface */ protected $nodeStorage; /** * Constructs the Rss 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 mixed $plugin_definition * The plugin implementation definition. * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager * The entity type manager. * @param \Drupal\Core\Entity\EntityDisplayRepositoryInterface $entity_display_repository * The entity display repository. */ public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, EntityDisplayRepositoryInterface $entity_display_repository = NULL) { parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $entity_display_repository); $this->nodeStorage = $entity_type_manager->getStorage('node'); } /** * {@inheritdoc} */ Loading @@ -82,7 +54,7 @@ public function preRender($values) { $nids[] = $row->{$this->field_alias}; } if (!empty($nids)) { $this->nodes = $this->nodeStorage->loadMultiple($nids); $this->nodes = $this->entityTypeManager->getStorage('node')->loadMultiple($nids); } } Loading
core/modules/taxonomy/src/TermBreadcrumbBuilder.php +1 −9 Original line number Diff line number Diff line Loading @@ -30,13 +30,6 @@ class TermBreadcrumbBuilder implements BreadcrumbBuilderInterface { */ protected $entityTypeManager; /** * The taxonomy storage. * * @var \Drupal\taxonomy\TermStorageInterface */ protected $termStorage; /** * Constructs the TermBreadcrumbBuilder. * Loading @@ -47,7 +40,6 @@ class TermBreadcrumbBuilder implements BreadcrumbBuilderInterface { */ public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityRepositoryInterface $entity_repository) { $this->entityTypeManager = $entity_type_manager; $this->termStorage = $entity_type_manager->getStorage('taxonomy_term'); $this->entityRepository = $entity_repository; } Loading @@ -73,7 +65,7 @@ public function build(RouteMatchInterface $route_match) { // @todo This overrides any other possible breadcrumb and is a pure // hard-coded presumption. Make this behavior configurable per // vocabulary or term. $parents = $this->termStorage->loadAllParents($term->id()); $parents = $this->entityTypeManager->getStorage('taxonomy_term')->loadAllParents($term->id()); // Remove current term being accessed. array_shift($parents); foreach (array_reverse($parents) as $term) { Loading
core/modules/taxonomy/taxonomy.tokens.inc +8 −4 Original line number Diff line number Diff line Loading @@ -95,7 +95,6 @@ function taxonomy_tokens($type, $tokens, array $data, array $options, Bubbleable $token_service = \Drupal::token(); $replacements = []; $taxonomy_storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term'); if ($type == 'term' && !empty($data['term'])) { $term = $data['term']; Loading Loading @@ -134,6 +133,7 @@ function taxonomy_tokens($type, $tokens, array $data, array $options, Bubbleable break; case 'parent': $taxonomy_storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term'); if ($parents = $taxonomy_storage->loadParents($term->id())) { $parent = array_pop($parents); $bubbleable_metadata->addCacheableDependency($parent); Loading @@ -148,11 +148,14 @@ function taxonomy_tokens($type, $tokens, array $data, array $options, Bubbleable $replacements += $token_service->generate('vocabulary', $vocabulary_tokens, ['vocabulary' => $vocabulary], $options, $bubbleable_metadata); } if (($vocabulary_tokens = $token_service->findWithPrefix($tokens, 'parent')) && $parents = $taxonomy_storage->loadParents($term->id())) { if (($vocabulary_tokens = $token_service->findWithPrefix($tokens, 'parent'))) { $taxonomy_storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term'); if ($parents = $taxonomy_storage->loadParents($term->id())) { $parent = array_pop($parents); $replacements += $token_service->generate('term', $vocabulary_tokens, ['term' => $parent], $options, $bubbleable_metadata); } } } elseif ($type == 'vocabulary' && !empty($data['vocabulary'])) { $vocabulary = $data['vocabulary']; Loading Loading @@ -182,6 +185,7 @@ function taxonomy_tokens($type, $tokens, array $data, array $options, Bubbleable break; case 'node-count': $taxonomy_storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term'); $replacements[$original] = $taxonomy_storage->nodeCount($vocabulary->id()); break; } Loading