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) { ...@@ -422,25 +422,6 @@ function entity_access_controller($entity_type) {
->getAccessController($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. * Returns the render array for an entity.
* *
......
...@@ -2,21 +2,21 @@ ...@@ -2,21 +2,21 @@
/** /**
* @file * @file
* Definition of Drupal\Core\Config\Entity\ConfigEntityListController. * Contains \Drupal\Core\Config\Entity\ConfigEntityListBuilder.
*/ */
namespace Drupal\Core\Config\Entity; namespace Drupal\Core\Config\Entity;
use Drupal\Core\Entity\EntityInterface; 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() { public function load() {
$entities = parent::load(); $entities = parent::load();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/** /**
* @file * @file
* Contains Drupal\Core\Config\Entity\DraggableListController. * Contains \Drupal\Core\Config\Entity\DraggableListBuilder.
*/ */
namespace Drupal\Core\Config\Entity; namespace Drupal\Core\Config\Entity;
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
use Drupal\Core\Form\FormInterface; 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. * The key to use for the form element containing the entities.
......
...@@ -25,7 +25,7 @@ class EntityListController extends ControllerBase { ...@@ -25,7 +25,7 @@ class EntityListController extends ControllerBase {
* A render array as expected by drupal_render(). * A render array as expected by drupal_render().
*/ */
public function listing($entity_type) { 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 { ...@@ -25,7 +25,7 @@ class EntityViewController implements ContainerInjectionInterface {
protected $entityManager; protected $entityManager;
/** /**
* Creates an EntityListController object. * Creates an EntityViewController object.
* *
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager. * The entity manager.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/** /**
* @file * @file
* Contains \Drupal\Core\Entity\EntityListController. * Contains \Drupal\Core\Entity\EntityListBuilder.
*/ */
namespace Drupal\Core\Entity; namespace Drupal\Core\Entity;
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
use Drupal\Component\Utility\String; 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. * The entity storage controller class.
...@@ -49,7 +49,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI ...@@ -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 * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type definition. * The entity type definition.
...@@ -63,14 +63,14 @@ public function __construct(EntityTypeInterface $entity_type, EntityStorageContr ...@@ -63,14 +63,14 @@ public function __construct(EntityTypeInterface $entity_type, EntityStorageContr
} }
/** /**
* Implements \Drupal\Core\Entity\EntityListControllerInterface::getStorageController(). * {@inheritdoc}
*/ */
public function getStorageController() { public function getStorageController() {
return $this->storage; return $this->storage;
} }
/** /**
* Implements \Drupal\Core\Entity\EntityListControllerInterface::load(). * {@inheritdoc}
*/ */
public function load() { public function load() {
return $this->storage->loadMultiple(); return $this->storage->loadMultiple();
...@@ -116,7 +116,7 @@ public function getOperations(EntityInterface $entity) { ...@@ -116,7 +116,7 @@ public function getOperations(EntityInterface $entity) {
* @return array * @return array
* A render array structure of header strings. * A render array structure of header strings.
* *
* @see \Drupal\Core\Entity\EntityListController::render() * @see \Drupal\Core\Entity\EntityListBuilder::render()
*/ */
public function buildHeader() { public function buildHeader() {
$row['operations'] = $this->t('Operations'); $row['operations'] = $this->t('Operations');
...@@ -132,7 +132,7 @@ public function buildHeader() { ...@@ -132,7 +132,7 @@ public function buildHeader() {
* @return array * @return array
* A render array structure of fields for this entity. * 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) { public function buildRow(EntityInterface $entity) {
$row['operations']['data'] = $this->buildOperations($entity); $row['operations']['data'] = $this->buildOperations($entity);
...@@ -148,7 +148,7 @@ public function buildRow(EntityInterface $entity) { ...@@ -148,7 +148,7 @@ public function buildRow(EntityInterface $entity) {
* @return array * @return array
* A renderable array of operation links. * A renderable array of operation links.
* *
* @see \Drupal\Core\Entity\EntityListController::render() * @see \Drupal\Core\Entity\EntityListBuilder::buildRow()
*/ */
public function buildOperations(EntityInterface $entity) { public function buildOperations(EntityInterface $entity) {
// Retrieve and sort operations. // Retrieve and sort operations.
...@@ -163,9 +163,9 @@ public function buildOperations(EntityInterface $entity) { ...@@ -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. * @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()) { ...@@ -199,7 +199,6 @@ protected function t($string, array $args = array(), array $options = array()) {
* *
* @return string * @return string
* A string title of the page. * A string title of the page.
*
*/ */
protected function getTitle() { protected function getTitle() {
return; return;
......
...@@ -2,32 +2,32 @@ ...@@ -2,32 +2,32 @@
/** /**
* @file * @file
* Contains \Drupal\Core\Entity\EntityListControllerInterface. * Contains \Drupal\Core\Entity\EntityListBuilderInterface.
*/ */
namespace Drupal\Core\Entity; 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. * Gets the entity storage controller.
* *
* @return \Drupal\Core\Entity\EntityStorageControllerInterface * @return \Drupal\Core\Entity\EntityStorageControllerInterface
* The storage controller used by this list controller. * The storage controller used by this list builder.
*/ */
public function getStorageController(); public function getStorageController();
/** /**
* Loads entities of this type from storage for listing. * 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. * sorting the loaded entities.
* *
* @return \Drupal\Core\Entity\EntityInterface[] * @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(); public function load();
...@@ -48,10 +48,10 @@ public function load(); ...@@ -48,10 +48,10 @@ public function load();
public function getOperations(EntityInterface $entity); 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 * @return array
* The output markup for the listing page. * A render array as expected by drupal_render().
*/ */
public function render(); public function render();
......
...@@ -191,8 +191,8 @@ public function getStorageController($entity_type) { ...@@ -191,8 +191,8 @@ public function getStorageController($entity_type) {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getListController($entity_type) { public function getListBuilder($entity_type) {
return $this->getController($entity_type, 'list', 'getListClass'); return $this->getController($entity_type, 'list_builder', 'getListBuilderClass');
} }
/** /**
......
...@@ -119,15 +119,15 @@ public function clearCachedDefinitions(); ...@@ -119,15 +119,15 @@ public function clearCachedDefinitions();
public function getViewBuilder($entity_type); public function getViewBuilder($entity_type);
/** /**
* Creates a new list controller instance. * Creates a new entity list builder.
* *
* @param string $entity_type * @param string $entity_type
* The entity type for this list controller. * The entity type for this list builder.
* *
* @return \Drupal\Core\Entity\EntityListControllerInterface * @return \Drupal\Core\Entity\EntityListBuilderInterface
* A list controller instance. * An entity list builder instance.
*/ */
public function getListController($entity_type); public function getListBuilder($entity_type);
/** /**
* Creates a new form controller instance. * Creates a new form controller instance.
......
...@@ -365,23 +365,23 @@ public function hasFormClasses() { ...@@ -365,23 +365,23 @@ public function hasFormClasses() {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getListClass() { public function getListBuilderClass() {
return $this->getControllerClass('list'); return $this->getControllerClass('list_builder');
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setListClass($class) { public function setListBuilderClass($class) {
$this->controllers['list'] = $class; $this->controllers['list_builder'] = $class;
return $this; return $this;
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function hasListClass() { public function hasListBuilderClass() {
return $this->hasControllerClass('list'); return $this->hasControllerClass('list_builder');
} }
/** /**
......
...@@ -194,7 +194,7 @@ public function getControllerClass($controller_type); ...@@ -194,7 +194,7 @@ public function getControllerClass($controller_type);
* entity forms when the forms are similar. The classes must implement * entity forms when the forms are similar. The classes must implement
* \Drupal\Core\Entity\EntityFormControllerInterface. * \Drupal\Core\Entity\EntityFormControllerInterface.
* - list: The name of the class that provides listings of the entities. The * - 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 * - render: The name of the class that is used to render the entities. The
* class must implement \Drupal\Core\Entity\EntityViewBuilderInterface. * class must implement \Drupal\Core\Entity\EntityViewBuilderInterface.
* - access: The name of the class that is used for access checks. The class * - access: The name of the class that is used for access checks. The class
...@@ -263,7 +263,7 @@ public function hasFormClasses(); ...@@ -263,7 +263,7 @@ public function hasFormClasses();
* @return string * @return string
* The class for this entity type's list. * The class for this entity type's list.
*/ */
public function getListClass(); public function getListBuilderClass();
/** /**
* Sets the list class. * Sets the list class.
...@@ -273,7 +273,7 @@ public function getListClass(); ...@@ -273,7 +273,7 @@ public function getListClass();
* *
* @return static * @return static
*/ */
public function setListClass($class); public function setListBuilderClass($class);
/** /**
* Indicates if this entity type has a list class. * Indicates if this entity type has a list class.
...@@ -281,7 +281,7 @@ public function setListClass($class); ...@@ -281,7 +281,7 @@ public function setListClass($class);
* @return bool * @return bool
* TRUE if there is a list for this entity type, FALSE otherwise. * TRUE if there is a list for this entity type, FALSE otherwise.
*/ */
public function hasListClass(); public function hasListBuilderClass();
/** /**
* Returns the view builder class. * Returns the view builder class.
......
...@@ -67,7 +67,7 @@ function action_entity_type_build(array &$entity_types) { ...@@ -67,7 +67,7 @@ function action_entity_type_build(array &$entity_types) {
->setFormClass('add', 'Drupal\action\ActionAddFormController') ->setFormClass('add', 'Drupal\action\ActionAddFormController')
->setFormClass('edit', 'Drupal\action\ActionEditFormController') ->setFormClass('edit', 'Drupal\action\ActionEditFormController')
->setFormClass('delete', 'Drupal\action\Form\ActionDeleteForm') ->setFormClass('delete', 'Drupal\action\Form\ActionDeleteForm')
->setListClass('Drupal\action\ActionListController') ->setListBuilderClass('Drupal\action\ActionListBuilder')
->setLinkTemplate('delete-form', 'action.delete') ->setLinkTemplate('delete-form', 'action.delete')
->setLinkTemplate('edit-form', 'action.admin_configure'); ->setLinkTemplate('edit-form', 'action.admin_configure');
} }
...@@ -2,23 +2,25 @@ ...@@ -2,23 +2,25 @@
/** /**
* @file * @file
* Contains \Drupal\action\ActionListController. * Contains \Drupal\action\ActionListBuilder.
*/ */
namespace Drupal\action; namespace Drupal\action;
use Drupal\Core\Action\ActionManager; use Drupal\Core\Action\ActionManager;
use Drupal\Core\Entity\EntityControllerInterface;
use Drupal\Core\Entity\EntityInterface; 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\EntityStorageControllerInterface;
use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; 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 * @var bool
...@@ -33,7 +35,7 @@ class ActionListController extends ConfigEntityListController implements EntityC ...@@ -33,7 +35,7 @@ class ActionListController extends ConfigEntityListController implements EntityC
protected $actionManager; protected $actionManager;
/** /**
* Constructs a new ActionListController object. * Constructs a new ActionListBuilder object.
* *
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type definition. * The entity type definition.
......
...@@ -2,18 +2,20 @@ ...@@ -2,18 +2,20 @@
/** /**
* @file * @file
* Contains \Drupal\custom_block\CustomBlockListController. * Contains \Drupal\custom_block\CustomBlockListBuilder.
*/ */
namespace Drupal\custom_block; namespace Drupal\custom_block;
use Drupal\Core\Entity\EntityInterface; 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} * {@inheritdoc}
......
...@@ -2,18 +2,20 @@ ...@@ -2,18 +2,20 @@
/** /**
* @file * @file
* Contains \Drupal\custom_block\CustomBlockTypeListController. * Contains \Drupal\custom_block\CustomBlockTypeListBuilder.
*/ */
namespace Drupal\custom_block; namespace Drupal\custom_block;
use Drupal\Core\Config\Entity\ConfigEntityListController; use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface; 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} * {@inheritdoc}
...@@ -29,7 +31,7 @@ public function getOperations(EntityInterface $entity) { ...@@ -29,7 +31,7 @@ public function getOperations(EntityInterface $entity) {
} }
/** /**
* Overrides \Drupal\Core\Entity\EntityListController::buildHeader(). * {@inheritdoc}
*/ */
public function buildHeader() { public function buildHeader() {
$header['type'] = t('Block type'); $header['type'] = t('Block type');
...@@ -38,7 +40,7 @@ public function buildHeader() { ...@@ -38,7 +40,7 @@ public function buildHeader() {