diff -u b/core/lib/Drupal/Core/Entity/EntityListBuilder.php b/core/lib/Drupal/Core/Entity/EntityListBuilder.php --- b/core/lib/Drupal/Core/Entity/EntityListBuilder.php +++ b/core/lib/Drupal/Core/Entity/EntityListBuilder.php @@ -247,9 +247,7 @@ * @return string */ protected function getAddLinkText() { - return $this->t('Add a new @label.', array( - '@label' => $this->entityType->getLabel(), - )); + return $this->t('Add one.'); } /** @@ -259,10 +257,10 @@ * The HTML link or FALSE if no link is available. */ protected function createAddLink() { - if ($this->entityType->hasLinkTemplate('add') && $this->entityAccess->createAccess()) { + if ($this->entityType->hasLinkTemplate('add-entity-form') && $this->entityAccess->createAccess()) { return $this->linkGenerator->generate( $this->getAddLinkText(), - $this->entityType->getLinkTemplate('add') + $this->entityType->getLinkTemplate('add-entity-form') ); } else { diff -u b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php --- b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php @@ -40,7 +40,7 @@ * "delete-form" = "custom_block.delete", * "edit-form" = "custom_block.edit", * "admin-form" = "custom_block.type_edit", - * "add" = "custom_block.add_page" + * "add-entity-form" = "custom_block.add_page" * }, * fieldable = TRUE, * translatable = TRUE, diff -u b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php --- b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php @@ -36,7 +36,7 @@ * links = { * "delete-form" = "custom_block.type_delete", * "edit-form" = "custom_block.type_edit", - * "add" = "custom_block.type_add" + * "add-entity-form" = "custom_block.type_add" * } * ) */ diff -u b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php --- b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php +++ b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php @@ -44,7 +44,7 @@ * "flush-form" = "image.style_flush", * "edit-form" = "image.style_edit", * "delete-form" = "image.style_delete", - * "add" = "image.style_add" + * "add-entity-form" = "image.style_add" * } * ) */ diff -u b/core/modules/node/lib/Drupal/node/Entity/Node.php b/core/modules/node/lib/Drupal/node/Entity/Node.php --- b/core/modules/node/lib/Drupal/node/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Entity/Node.php @@ -56,7 +56,7 @@ * "edit-form" = "node.page_edit", * "version-history" = "node.revision_overview", * "admin-form" = "node.type_edit", - * "add" = "node.add_page" + * "add-entity-form" = "node.add_page" * } * ) */ diff -u b/core/modules/node/lib/Drupal/node/Entity/NodeType.php b/core/modules/node/lib/Drupal/node/Entity/NodeType.php --- b/core/modules/node/lib/Drupal/node/Entity/NodeType.php +++ b/core/modules/node/lib/Drupal/node/Entity/NodeType.php @@ -38,7 +38,7 @@ * "add-form" = "node.add", * "edit-form" = "node.type_edit", * "delete-form" = "node.type_delete_confirm", - * "add" = "node.type_add" + * "add-entity-form" = "node.type_add" * } * ) */ diff -u b/core/modules/node/lib/Drupal/node/NodeTypeListBuilder.php b/core/modules/node/lib/Drupal/node/NodeTypeListBuilder.php --- b/core/modules/node/lib/Drupal/node/NodeTypeListBuilder.php +++ b/core/modules/node/lib/Drupal/node/NodeTypeListBuilder.php @@ -8,13 +8,8 @@ namespace Drupal\node; use Drupal\Core\Config\Entity\ConfigEntityListBuilder; -use Drupal\Core\Entity\EntityTypeInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Routing\UrlGeneratorInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Component\Utility\Xss; -use Drupal\Component\Utility\String; /** * Defines a class to build a listing of node type entities. @@ -24,39 +19,6 @@ class NodeTypeListBuilder extends ConfigEntityListBuilder { /** - * The url generator service. - * - * @var \Drupal\Core\Routing\UrlGeneratorInterface - */ - protected $urlGenerator; - - /** - * Constructs a NodeTypeForm object. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type definition. - * @param \Drupal\Core\Entity\EntityStorageInterface $storage - * The entity storage class. - * @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator - * The url generator service. - */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, UrlGeneratorInterface $url_generator) { - parent::__construct($entity_type, $storage); - $this->urlGenerator = $url_generator; - } - - /** - * {@inheritdoc} - */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { - return new static( - $entity_type, - $container->get('entity.manager')->getStorage($entity_type->id()), - $container->get('url_generator') - ); - } - - /** * {@inheritdoc} */ public function buildHeader() { diff -u b/core/modules/responsive_image/lib/Drupal/responsive_image/Entity/ResponsiveImageMapping.php b/core/modules/responsive_image/lib/Drupal/responsive_image/Entity/ResponsiveImageMapping.php --- b/core/modules/responsive_image/lib/Drupal/responsive_image/Entity/ResponsiveImageMapping.php +++ b/core/modules/responsive_image/lib/Drupal/responsive_image/Entity/ResponsiveImageMapping.php @@ -35,7 +35,7 @@ * links = { * "edit-form" = "responsive_image.mapping_page_edit", * "duplicate-form" = "responsive_image.mapping_page_duplicate", - * "add" = "responsive_image.mapping_page_add" + * "add-entity-form" = "responsive_image.mapping_page_add" * } * ) */ diff -u b/core/modules/system/lib/Drupal/system/Entity/DateFormat.php b/core/modules/system/lib/Drupal/system/Entity/DateFormat.php --- b/core/modules/system/lib/Drupal/system/Entity/DateFormat.php +++ b/core/modules/system/lib/Drupal/system/Entity/DateFormat.php @@ -34,7 +34,7 @@ * links = { * "delete-form" = "system.date_format_delete", * "edit-form" = "system.date_format_edit", - * "add" = "system.date_format_add" + * "add-entity-form" = "system.date_format_add" * } * ) */ only in patch2: unchanged: --- a/core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php +++ b/core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php @@ -7,10 +7,12 @@ namespace Drupal\Core\Config\Entity; +use Drupal\Core\Entity\EntityAccessControllerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Form\FormInterface; +use Drupal\Core\Utility\LinkGeneratorInterface; /** * Defines a class to build a draggable listing of configuration entities. @@ -48,8 +50,8 @@ /** * {@inheritdoc} */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControllerInterface $entity_access, LinkGeneratorInterface $link_generator) { + parent::__construct($entity_type, $storage, $entity_access, $link_generator); // Check if the entity type supports weighting. if ($this->entityType->hasKey('weight')) { only in patch2: unchanged: --- a/core/modules/action/lib/Drupal/action/ActionListBuilder.php +++ b/core/modules/action/lib/Drupal/action/ActionListBuilder.php @@ -8,10 +8,12 @@ namespace Drupal\action; use Drupal\Core\Action\ActionManager; +use Drupal\Core\Entity\EntityAccessControllerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Config\Entity\ConfigEntityListBuilder; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Utility\LinkGeneratorInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -41,11 +43,15 @@ class ActionListBuilder extends ConfigEntityListBuilder { * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The action storage. + * @param \Drupal\Core\Entity\EntityAccessControllerInterface $entity_access + * The entity access controller. + * @param \Drupal\Core\Utility\LinkGeneratorInterface $link_generator + * The link generator. * @param \Drupal\Core\Action\ActionManager $action_manager * The action plugin manager. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, ActionManager $action_manager) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControllerInterface $entity_access, LinkGeneratorInterface $link_generator, ActionManager $action_manager) { + parent::__construct($entity_type, $storage, $entity_access, $link_generator); $this->actionManager = $action_manager; } @@ -54,9 +60,14 @@ public function __construct(EntityTypeInterface $entity_type, EntityStorageInter * {@inheritdoc} */ public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { + /** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */ + $entity_manager = $container->get('entity.manager'); + return new static( $entity_type, - $container->get('entity.manager')->getStorage($entity_type->id()), + $entity_manager->getStorage($entity_type->id()), + $entity_manager->getAccessController($entity_type->id()), + $container->get('link_generator'), $container->get('plugin.manager.action') ); } only in patch2: unchanged: --- a/core/modules/block/lib/Drupal/block/BlockListBuilder.php +++ b/core/modules/block/lib/Drupal/block/BlockListBuilder.php @@ -12,10 +12,12 @@ use Drupal\Component\Utility\String; use Drupal\Core\Cache\Cache; use Drupal\Core\Config\Entity\ConfigEntityListBuilder; +use Drupal\Core\Entity\EntityAccessControllerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Form\FormInterface; +use Drupal\Core\Utility\LinkGeneratorInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; @@ -61,11 +63,15 @@ class BlockListBuilder extends ConfigEntityListBuilder implements FormInterface * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The entity storage class. + * @param \Drupal\Core\Entity\EntityAccessControllerInterface $entity_access + * The entity access controller. + * @param \Drupal\Core\Utility\LinkGeneratorInterface $link_generator + * The link generator. * @param \Drupal\block\BlockManagerInterface $block_manager * The block manager. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, BlockManagerInterface $block_manager) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControllerInterface $entity_access, LinkGeneratorInterface $link_generator, BlockManagerInterface $block_manager) { + parent::__construct($entity_type, $storage, $entity_access, $link_generator); $this->blockManager = $block_manager; } @@ -74,9 +80,14 @@ public function __construct(EntityTypeInterface $entity_type, EntityStorageInter * {@inheritdoc} */ public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { + /** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */ + $entity_manager = $container->get('entity.manager'); + return new static( $entity_type, - $container->get('entity.manager')->getStorage($entity_type->id()), + $entity_manager->getStorage($entity_type->id()), + $entity_manager->getAccessController($entity_type->id()), + $container->get('link_generator'), $container->get('plugin.manager.block') ); } only in patch2: unchanged: --- a/core/modules/field_ui/lib/Drupal/field_ui/FieldInstanceConfigListBuilder.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/FieldInstanceConfigListBuilder.php @@ -9,9 +9,6 @@ use Drupal\Core\Config\Entity\ConfigEntityListBuilder; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Entity\EntityTypeInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; /** * Provides lists of field instance config entities. @@ -19,33 +16,6 @@ class FieldInstanceConfigListBuilder extends ConfigEntityListBuilder { /** - * The entity manager. - * - * @var \Drupal\Core\Entity\EntityManagerInterface - */ - protected $entityManager; - - /** - * Constructs a new class instance. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type definition. - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager - * The entity manager. - */ - public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager) { - parent::__construct($entity_type, $entity_manager->getStorage($entity_type->id())); - $this->entityManager = $entity_manager; - } - - /** - * {@inheritdoc} - */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { - return new static($entity_type, $container->get('entity.manager')); - } - - /** * {@inheritdoc} */ public function render() { only in patch2: unchanged: --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewListBuilder.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewListBuilder.php @@ -9,10 +9,12 @@ use Drupal\Component\Utility\String; use Drupal\Component\Plugin\PluginManagerInterface; +use Drupal\Core\Entity\EntityAccessControllerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Config\Entity\ConfigEntityListBuilder; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Utility\LinkGeneratorInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -33,9 +35,14 @@ class ViewListBuilder extends ConfigEntityListBuilder { * {@inheritdoc} */ public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { + /** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */ + $entity_manager = $container->get('entity.manager'); + return new static( $entity_type, - $container->get('entity.manager')->getStorage($entity_type->id()), + $entity_manager->getStorage($entity_type->id()), + $entity_manager->getAccessController($entity_type->id()), + $container->get('link_generator'), $container->get('plugin.manager.views.display') ); } @@ -47,11 +54,15 @@ public static function createInstance(ContainerInterface $container, EntityTypeI * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageInterface $storage. * The entity storage class. + * @param \Drupal\Core\Entity\EntityAccessControllerInterface $entity_access + * The entity access controller. + * @param \Drupal\Core\Utility\LinkGeneratorInterface $link_generator + * The link generator. * @param \Drupal\Component\Plugin\PluginManagerInterface $display_manager * The views display plugin manager to use. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, PluginManagerInterface $display_manager) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControllerInterface $entity_access, LinkGeneratorInterface $link_generator, PluginManagerInterface $display_manager) { + parent::__construct($entity_type, $storage, $entity_access, $link_generator); $this->displayManager = $display_manager; }