Commit 5abaa5f9 authored by alexpott's avatar alexpott

Issue #2120871 by andypost, Berdir, amateescu, vladan.me, Xano: Rename...

Issue #2120871 by andypost, Berdir, amateescu, vladan.me, Xano: Rename EntityListController to EntityListBuilder.
parent a6ffb282
......@@ -422,25 +422,6 @@ function entity_access_controller($entity_type) {
->getAccessController($entity_type);
}
/**
* Returns an entity list controller for a given entity type.
*
* @param string $entity_type
* The type of the entity.
*
* @return \Drupal\Core\Entity\EntityListControllerInterface
* An entity list controller.
*
* @see \Drupal\Core\Entity\EntityManagerInterface::getListController().
*
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
* Use \Drupal::entityManager()->getListController().
*/
function entity_list_controller($entity_type) {
return \Drupal::entityManager()
->getListController($entity_type);
}
/**
* Returns the render array for an entity.
*
......
......@@ -2,21 +2,21 @@
/**
* @file
* Definition of Drupal\Core\Config\Entity\ConfigEntityListController.
* Contains \Drupal\Core\Config\Entity\ConfigEntityListBuilder.
*/
namespace Drupal\Core\Config\Entity;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListController;
use Drupal\Core\Entity\EntityListBuilder;
/**
* Defines the default list controller for ConfigEntity objects.
* Defines the default class to build a listing of configuration entities.
*/
class ConfigEntityListController extends EntityListController {
class ConfigEntityListBuilder extends EntityListBuilder {
/**
* Overrides Drupal\Core\Entity\EntityListController::load().
* {@inheritdoc}
*/
public function load() {
$entities = parent::load();
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains Drupal\Core\Config\Entity\DraggableListController.
* Contains \Drupal\Core\Config\Entity\DraggableListBuilder.
*/
namespace Drupal\Core\Config\Entity;
......@@ -13,9 +13,9 @@
use Drupal\Core\Form\FormInterface;
/**
* Provides a list controller for draggable configuration entities.
* Defines a class to build a draggable listing of configuration entities.
*/
abstract class DraggableListController extends ConfigEntityListController implements FormInterface {
abstract class DraggableListBuilder extends ConfigEntityListBuilder implements FormInterface {
/**
* The key to use for the form element containing the entities.
......
......@@ -25,7 +25,7 @@ class EntityListController extends ControllerBase {
* A render array as expected by drupal_render().
*/
public function listing($entity_type) {
return $this->entityManager()->getListController($entity_type)->render();
return $this->entityManager()->getListBuilder($entity_type)->render();
}
}
......
......@@ -25,7 +25,7 @@ class EntityViewController implements ContainerInjectionInterface {
protected $entityManager;
/**
* Creates an EntityListController object.
* Creates an EntityViewController object.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\Core\Entity\EntityListController.
* Contains \Drupal\Core\Entity\EntityListBuilder.
*/
namespace Drupal\Core\Entity;
......@@ -13,9 +13,9 @@
use Drupal\Component\Utility\String;
/**
* Provides a generic implementation of an entity list controller.
* Defines a generic implementation to build a listing of entities.
*/
class EntityListController extends EntityControllerBase implements EntityListControllerInterface, EntityControllerInterface {
class EntityListBuilder extends EntityControllerBase implements EntityListBuilderInterface, EntityControllerInterface {
/**
* The entity storage controller class.
......@@ -49,7 +49,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
}
/**
* Constructs a new EntityListController object.
* Constructs a new EntityListBuilder object.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type definition.
......@@ -63,14 +63,14 @@ public function __construct(EntityTypeInterface $entity_type, EntityStorageContr
}
/**
* Implements \Drupal\Core\Entity\EntityListControllerInterface::getStorageController().
* {@inheritdoc}
*/
public function getStorageController() {
return $this->storage;
}
/**
* Implements \Drupal\Core\Entity\EntityListControllerInterface::load().
* {@inheritdoc}
*/
public function load() {
return $this->storage->loadMultiple();
......@@ -116,7 +116,7 @@ public function getOperations(EntityInterface $entity) {
* @return array
* A render array structure of header strings.
*
* @see \Drupal\Core\Entity\EntityListController::render()
* @see \Drupal\Core\Entity\EntityListBuilder::render()
*/
public function buildHeader() {
$row['operations'] = $this->t('Operations');
......@@ -132,7 +132,7 @@ public function buildHeader() {
* @return array
* A render array structure of fields for this entity.
*
* @see \Drupal\Core\Entity\EntityListController::render()
* @see \Drupal\Core\Entity\EntityListBuilder::render()
*/
public function buildRow(EntityInterface $entity) {
$row['operations']['data'] = $this->buildOperations($entity);
......@@ -148,7 +148,7 @@ public function buildRow(EntityInterface $entity) {
* @return array
* A renderable array of operation links.
*
* @see \Drupal\Core\Entity\EntityListController::render()
* @see \Drupal\Core\Entity\EntityListBuilder::buildRow()
*/
public function buildOperations(EntityInterface $entity) {
// Retrieve and sort operations.
......@@ -163,9 +163,9 @@ public function buildOperations(EntityInterface $entity) {
}
/**
* Implements \Drupal\Core\Entity\EntityListControllerInterface::render().
* {@inheritdoc}
*
* Builds the entity list as renderable array for theme_table().
* Builds the entity listing as renderable array for theme_table().
*
* @todo Add a link to add a new item to the #empty text.
*/
......@@ -199,7 +199,6 @@ protected function t($string, array $args = array(), array $options = array()) {
*
* @return string
* A string title of the page.
*
*/
protected function getTitle() {
return;
......
......@@ -2,32 +2,32 @@
/**
* @file
* Contains \Drupal\Core\Entity\EntityListControllerInterface.
* Contains \Drupal\Core\Entity\EntityListBuilderInterface.
*/
namespace Drupal\Core\Entity;
/**
* Defines an interface for entity list controllers.
* Defines an interface to build entity listings.
*/
interface EntityListControllerInterface {
interface EntityListBuilderInterface {
/**
* Gets the entity storage controller.
*
* @return \Drupal\Core\Entity\EntityStorageControllerInterface
* The storage controller used by this list controller.
* The storage controller used by this list builder.
*/
public function getStorageController();
/**
* Loads entities of this type from storage for listing.
*
* This allows the controller to manipulate the list, like filtering or
* This allows the implementation to manipulate the listing, like filtering or
* sorting the loaded entities.
*
* @return \Drupal\Core\Entity\EntityInterface[]
* An array of entities implementing Drupal\Core\Entity\EntityInterface.
* An array of entities implementing \Drupal\Core\Entity\EntityInterface.
*/
public function load();
......@@ -48,10 +48,10 @@ public function load();
public function getOperations(EntityInterface $entity);
/**
* Renders the list page markup to be output.
* Returns a listing of entities for the given entity type.
*
* @return string
* The output markup for the listing page.
* @return array
* A render array as expected by drupal_render().
*/
public function render();
......
......@@ -191,8 +191,8 @@ public function getStorageController($entity_type) {
/**
* {@inheritdoc}
*/
public function getListController($entity_type) {
return $this->getController($entity_type, 'list', 'getListClass');
public function getListBuilder($entity_type) {
return $this->getController($entity_type, 'list_builder', 'getListBuilderClass');
}
/**
......
......@@ -119,15 +119,15 @@ public function clearCachedDefinitions();
public function getViewBuilder($entity_type);
/**
* Creates a new list controller instance.
* Creates a new entity list builder.
*
* @param string $entity_type
* The entity type for this list controller.
* The entity type for this list builder.
*
* @return \Drupal\Core\Entity\EntityListControllerInterface
* A list controller instance.
* @return \Drupal\Core\Entity\EntityListBuilderInterface
* An entity list builder instance.
*/
public function getListController($entity_type);
public function getListBuilder($entity_type);
/**
* Creates a new form controller instance.
......
......@@ -365,23 +365,23 @@ public function hasFormClasses() {
/**
* {@inheritdoc}
*/
public function getListClass() {
return $this->getControllerClass('list');
public function getListBuilderClass() {
return $this->getControllerClass('list_builder');
}
/**
* {@inheritdoc}
*/
public function setListClass($class) {
$this->controllers['list'] = $class;
public function setListBuilderClass($class) {
$this->controllers['list_builder'] = $class;
return $this;
}
/**
* {@inheritdoc}
*/
public function hasListClass() {
return $this->hasControllerClass('list');
public function hasListBuilderClass() {
return $this->hasControllerClass('list_builder');
}
/**
......
......@@ -194,7 +194,7 @@ public function getControllerClass($controller_type);
* entity forms when the forms are similar. The classes must implement
* \Drupal\Core\Entity\EntityFormControllerInterface.
* - list: The name of the class that provides listings of the entities. The
* class must implement \Drupal\Core\Entity\EntityListControllerInterface.
* class must implement \Drupal\Core\Entity\EntityListBuilderInterface.
* - render: The name of the class that is used to render the entities. The
* class must implement \Drupal\Core\Entity\EntityViewBuilderInterface.
* - access: The name of the class that is used for access checks. The class
......@@ -263,7 +263,7 @@ public function hasFormClasses();
* @return string
* The class for this entity type's list.
*/
public function getListClass();
public function getListBuilderClass();
/**
* Sets the list class.
......@@ -273,7 +273,7 @@ public function getListClass();
*
* @return static
*/
public function setListClass($class);
public function setListBuilderClass($class);
/**
* Indicates if this entity type has a list class.
......@@ -281,7 +281,7 @@ public function setListClass($class);
* @return bool
* TRUE if there is a list for this entity type, FALSE otherwise.
*/
public function hasListClass();
public function hasListBuilderClass();
/**
* Returns the view builder class.
......
......@@ -67,7 +67,7 @@ function action_entity_type_build(array &$entity_types) {
->setFormClass('add', 'Drupal\action\ActionAddFormController')
->setFormClass('edit', 'Drupal\action\ActionEditFormController')
->setFormClass('delete', 'Drupal\action\Form\ActionDeleteForm')
->setListClass('Drupal\action\ActionListController')
->setListBuilderClass('Drupal\action\ActionListBuilder')
->setLinkTemplate('delete-form', 'action.delete')
->setLinkTemplate('edit-form', 'action.admin_configure');
}
......@@ -2,23 +2,25 @@
/**
* @file
* Contains \Drupal\action\ActionListController.
* Contains \Drupal\action\ActionListBuilder.
*/
namespace Drupal\action;
use Drupal\Core\Action\ActionManager;
use Drupal\Core\Entity\EntityControllerInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Config\Entity\ConfigEntityListController;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides a listing of Actions.
* Defines a class to build a listing of action entities.
*
* @see \Drupal\system\Entity\Action
* @see action_entity_info()
*/
class ActionListController extends ConfigEntityListController implements EntityControllerInterface {
class ActionListBuilder extends ConfigEntityListBuilder {
/**
* @var bool
......@@ -33,7 +35,7 @@ class ActionListController extends ConfigEntityListController implements EntityC
protected $actionManager;
/**
* Constructs a new ActionListController object.
* Constructs a new ActionListBuilder object.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type definition.
......
......@@ -2,18 +2,20 @@
/**
* @file
* Contains \Drupal\custom_block\CustomBlockListController.
* Contains \Drupal\custom_block\CustomBlockListBuilder.
*/
namespace Drupal\custom_block;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListController;
use Drupal\Core\Entity\EntityListBuilder;
/**
* Provides a listing of custom block entities.
* Defines a class to build a listing of custom block entities.
*
* @see \Drupal\custom_block\Entity\CustomBlock
*/
class CustomBlockListController extends EntityListController {
class CustomBlockListBuilder extends EntityListBuilder {
/**
* {@inheritdoc}
......
......@@ -2,18 +2,20 @@
/**
* @file
* Contains \Drupal\custom_block\CustomBlockTypeListController.
* Contains \Drupal\custom_block\CustomBlockTypeListBuilder.
*/
namespace Drupal\custom_block;
use Drupal\Core\Config\Entity\ConfigEntityListController;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
/**
* Provides a listing of custom block types.
* Defines a class to build a listing of custom block type entities.
*
* @see \Drupal\custom_block\Entity\CustomBlockType
*/
class CustomBlockTypeListController extends ConfigEntityListController {
class CustomBlockTypeListBuilder extends ConfigEntityListBuilder {
/**
* {@inheritdoc}
......@@ -29,7 +31,7 @@ public function getOperations(EntityInterface $entity) {
}
/**
* Overrides \Drupal\Core\Entity\EntityListController::buildHeader().
* {@inheritdoc}
*/
public function buildHeader() {
$header['type'] = t('Block type');
......@@ -38,7 +40,7 @@ public function buildHeader() {
}
/**
* Overrides \Drupal\Core\Entity\EntityListController::buildRow().
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
$uri = $entity->urlInfo();
......
......@@ -22,7 +22,7 @@
* bundle_label = @Translation("Custom Block type"),
* controllers = {
* "access" = "Drupal\custom_block\CustomBlockAccessController",
* "list" = "Drupal\custom_block\CustomBlockListController",
* "list_builder" = "Drupal\custom_block\CustomBlockListBuilder",
* "view_builder" = "Drupal\custom_block\CustomBlockViewBuilder",
* "form" = {
* "add" = "Drupal\custom_block\CustomBlockFormController",
......
......@@ -24,7 +24,7 @@
* "edit" = "Drupal\custom_block\CustomBlockTypeFormController",
* "delete" = "Drupal\custom_block\Form\CustomBlockTypeDeleteForm"
* },
* "list" = "Drupal\custom_block\CustomBlockTypeListController"
* "list_builder" = "Drupal\custom_block\CustomBlockTypeListBuilder"
* },
* admin_permission = "administer blocks",
* config_prefix = "type",
......
......@@ -12,7 +12,7 @@
/**
* Tests the listing of custom blocks.
*
* @see \Drupal\block\CustomBlockListController
* @see \Drupal\block\CustomBlockListBuilder
*/
class CustomBlockListTest extends WebTestBase {
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\block\BlockListController.
* Contains \Drupal\block\BlockListBuilder.
*/
namespace Drupal\block;
......@@ -11,20 +11,20 @@
use Drupal\Component\Utility\Json;
use Drupal\Component\Utility\String;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Config\Entity\ConfigEntityListController;
use Drupal\Core\Entity\EntityControllerInterface;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
/**
* Defines the block list controller.
* Defines a class to build a listing of block entities.
*
* @see \Drupal\block\Entity\Block
*/
class BlockListController extends ConfigEntityListController implements FormInterface, EntityControllerInterface {
class BlockListBuilder extends ConfigEntityListBuilder implements FormInterface {
/**
* The regions containing the blocks.
......@@ -55,7 +55,7 @@ class BlockListController extends ConfigEntityListController implements FormInte
protected $blockManager;
/**
* Constructs a new BlockListController object.
* Constructs a new BlockListBuilder object.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type definition.
......@@ -82,7 +82,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
}
/**
* Overrides \Drupal\Core\Config\Entity\ConfigEntityListController::load().
* {@inheritdoc}
*/
public function load() {
// If no theme was specified, use the current theme.
......@@ -103,7 +103,7 @@ public function load() {
}
/**
* Overrides \Drupal\Core\Entity\EntityListController::render().
* {@inheritdoc}
*
* @param string|null $theme
* (optional) The theme to display the blocks for. If NULL, the current
......
......@@ -8,7 +8,6 @@
namespace Drupal\block\Controller;
use Drupal\Core\Entity\Controller\EntityListController;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
/**
......@@ -29,7 +28,7 @@ class BlockListController extends EntityListController {
*/
public function listing($theme = NULL, Request $request = NULL) {
$theme = $theme ?: $this->config('system.theme')->get('default');
return $this->entityManager()->getListController('block')->render($theme, $request);
return $this->entityManager()->getListBuilder('block')->render($theme, $request);
}
}
......@@ -23,7 +23,7 @@
* controllers = {
* "access" = "Drupal\block\BlockAccessController",
* "view_builder" = "Drupal\block\BlockViewBuilder",
* "list" = "Drupal\block\BlockListController",
* "list_builder" = "Drupal\block\BlockListBuilder",
* "form" = {
* "default" = "Drupal\block\BlockFormController",
* "delete" = "Drupal\block\Form\BlockDeleteForm"
......
......@@ -32,10 +32,10 @@ public static function getInfo() {
}
/**
* Tests entity list controller methods.
* Tests entity list builder methods.
*/
function testList() {
$controller = \Drupal::entityManager()->getListController('config_test');
$controller = \Drupal::entityManager()->getListBuilder('config_test');
// Test getStorageController() method.
$this->assertTrue($controller->getStorageController() instanceof EntityStorageControllerInterface, 'EntityStorageController instance in storage.');
......@@ -116,7 +116,7 @@ function testList() {
// Test that config entities that do not support status, do not have
// enable/disable operations.
$controller = $this->container->get('entity.manager')
->getListController('config_test_no_status');
->getListBuilder('config_test_no_status');
$list = $controller->load();
$entity = $list['default'];
......
......@@ -2,18 +2,20 @@
/**
* @file
* Contains \Drupal\config_test\ConfigTestListController.
* Contains \Drupal\config_test\ConfigTestListBuilder.
*/
namespace Drupal\config_test;
use Drupal\Core\Config\Entity\ConfigEntityListController;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
/**
* Provides a list controller for config_test.
* Defines a class to build a listing of ConfigTest entities.
*
* @see \Drupal\config_test\Entity\ConfigTest
*/
class ConfigTestListController extends ConfigEntityListController {
class ConfigTestListBuilder extends ConfigEntityListBuilder {
/**
* {@inheritdoc}
......
......@@ -15,7 +15,7 @@
* label = @Translation("Test configuration for query"),
* controllers = {
* "storage" = "Drupal\config_test\ConfigTestStorageController",
* "list" = "Drupal\Core\Config\Entity\ConfigEntityListController",
* "list_builder" = "Drupal\Core\Config\Entity\ConfigEntityListBuilder",
* "form" = {
* "default" = "Drupal\config_test\ConfigTestFormController"
* }
......
......@@ -18,7 +18,7 @@
* label = @Translation("Test configuration"),
* controllers = {
* "storage" = "Drupal\config_test\ConfigTestStorageController",
* "list" = "Drupal\config_test\ConfigTestListController",
* "list_builder" = "Drupal\config_test\ConfigTestListBuilder",
* "form" = {
* "default" = "Drupal\config_test\ConfigTestFormController",
* "delete" = "Drupal\config_test\Form\ConfigTestDeleteForm"
......
......@@ -78,15 +78,15 @@ function config_translation_entity_type_alter(array &$entity_types) {
foreach ($entity_types as $entity_type_id => $entity_type) {
if ($entity_type->isSubclassOf('Drupal\Core\Config\Entity\ConfigEntityInterface')) {
if ($entity_type_id == 'block') {
$class = 'Drupal\config_translation\Controller\ConfigTranslationBlockListController';
$class = 'Drupal\config_translation\Controller\ConfigTranslationBlockListBuilder';
}
elseif ($entity_type_id == 'field_instance_config') {
$class = 'Drupal\config_translation\Controller\ConfigTranslationFieldInstanceListController';
$class = 'Drupal\config_translation\Controller\ConfigTranslationFieldInstanceListBuilder';
// Will be filled in dynamically, see \Drupal\field\Entity\FieldInstanceConfig::linkTemplates().
$entity_type->setLinkTemplate('drupal:config-translation-overview', 'config_translation.item.overview.');
}
else {
$class = 'Drupal\config_translation\Controller\ConfigTranslationEntityListController';
$class = 'Drupal\config_translation\Controller\ConfigTranslationEntityListBuilder';
}
$entity_type->setControllerClass('config_translation_list', $class);
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\config_translation\Controller\ConfigTranslationBlockListController.
* Contains \Drupal\config_translation\Controller\ConfigTranslationBlockListBuilder.
*/
namespace Drupal\config_translation\Controller;
......@@ -15,9 +15,9 @@
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Defines the config translation controller for blocks.
* Defines the config translation list builder for blocks.
*/
class ConfigTranslationBlockListController extends ConfigTranslationEntityListController {
class ConfigTranslationBlockListBuilder extends ConfigTranslationEntityListBuilder {
/**
* An array of theme info keyed by theme name.
......
......@@ -2,18 +2,18 @@
/**
* @file
* Contains \Drupal\config_translation\Controller\ConfigTranslationEntityListController.
* Contains \Drupal\config_translation\Controller\ConfigTranslationEntityListBuilder.