diff --git a/core/modules/action/src/ActionListBuilder.php b/core/modules/action/src/ActionListBuilder.php index 09024037b326534db4b2bbc7212873b3cc3fc196..0a54cd65270916925fd89fb58ef2668c52bd8d41 100644 --- a/core/modules/action/src/ActionListBuilder.php +++ b/core/modules/action/src/ActionListBuilder.php @@ -108,10 +108,10 @@ public function getDefaultOperations(EntityInterface $entity) { * {@inheritdoc} */ public function render() { - $build['action_header']['#markup'] = '

' . t('Available actions:') . '

'; + $build['action_header']['#markup'] = '

' . $this->t('Available actions:') . '

'; $build['action_table'] = parent::render(); if (!$this->hasConfigurableActions) { - unset($build['action_table']['#header']['operations']); + unset($build['action_table']['table']['#header']['operations']); } $build['action_admin_manage_form'] = \Drupal::formBuilder()->getForm('Drupal\action\Form\ActionAdminManageForm'); return $build; diff --git a/core/modules/action/src/Tests/ActionListTest.php b/core/modules/action/src/Tests/ActionListTest.php new file mode 100644 index 0000000000000000000000000000000000000000..f533cdf1b5058311a6a89fbafe297f6bd86956cb --- /dev/null +++ b/core/modules/action/src/Tests/ActionListTest.php @@ -0,0 +1,37 @@ +drupalLogin($this->drupalCreateUser(['administer actions'])); + + // Ensure the empty text appears on the action list page. + /** @var $storage \Drupal\Core\Entity\EntityStorageInterface */ + $storage = $this->container->get('entity.manager')->getStorage('action'); + $actions = $storage->loadMultiple(); + $storage->delete($actions); + $this->drupalGet('/admin/config/system/actions'); + $this->assertRaw('There is no Action yet.'); + } + +} diff --git a/core/modules/image/src/ImageStyleListBuilder.php b/core/modules/image/src/ImageStyleListBuilder.php index e4e0be6588b50e7a67bdaa2195950b67a4fc5659..140ed46b8cbd6056b00bbe7e8b9f77d3ba189a84 100644 --- a/core/modules/image/src/ImageStyleListBuilder.php +++ b/core/modules/image/src/ImageStyleListBuilder.php @@ -4,10 +4,7 @@ use Drupal\Core\Config\Entity\ConfigEntityListBuilder; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Routing\UrlGeneratorInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\Core\Url; /** * Defines a class to build a listing of image style entities. @@ -16,40 +13,6 @@ */ class ImageStyleListBuilder extends ConfigEntityListBuilder { - /** - * The URL generator. - * - * @var \Drupal\Core\Routing\UrlGeneratorInterface - */ - protected $urlGenerator; - - /** - * Constructs a new ImageStyleListBuilder object. - * - * @param EntityTypeInterface $entity_type - * The entity type definition. - * @param \Drupal\Core\Entity\EntityStorageInterface $image_style_storage - * The image style entity storage class. - * @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator - * The URL generator. - */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $image_style_storage, UrlGeneratorInterface $url_generator) { - parent::__construct($entity_type, $image_style_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'), - $container->get('string_translation') - ); - } - /** * {@inheritdoc} */ @@ -87,7 +50,7 @@ public function getDefaultOperations(EntityInterface $entity) { public function render() { $build = parent::render(); $build['table']['#empty'] = $this->t('There are currently no styles. Add a new one.', [ - ':url' => $this->urlGenerator->generateFromRoute('image.style_add'), + ':url' => Url::fromRoute('image.style_add')->toString(), ]); return $build; }