class EntityListController

Same name in this branch
  1. 8.x drupal/core/lib/Drupal/Core/Entity/Controller/EntityListController.php \Drupal\Core\Entity\Controller\EntityListController
  2. 8.x drupal/core/lib/Drupal/Core/Entity/EntityListController.php \Drupal\Core\Entity\EntityListController

Defines a generic controller to list entities.

Hierarchy

Expanded class hierarchy of EntityListController

File

drupal/core/lib/Drupal/Core/Entity/Controller/EntityListController.php, line 17
Contains \Drupal\Core\Entity\Controller\EntityListController.

Namespace

Drupal\Core\Entity\Controller
View source
class EntityListController implements ControllerInterface {

  /**
   * The entity manager
   *
   * @var \Drupal\Core\Entity\EntityManager
   */
  protected $entityManager;

  /**
   * Creates an EntityListController object.
   *
   * @param \Drupal\Core\Entity\EntityManager $entity_manager
   *   The entity manager.
   */
  public function __construct(EntityManager $entity_manager) {
    $this->entityManager = $entity_manager;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static($container
      ->get('plugin.manager.entity'));
  }

  /**
   * Provides the listing page for any entity type.
   *
   * @return array
   *   A render array as expected by drupal_render().
   */
  public function listing($entity_type) {
    return $this->entityManager
      ->getListController($entity_type)
      ->render();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityListController::$entityManager protected property The entity manager
EntityListController::create public static function Instantiates a new instance of this controller. Overrides ControllerInterface::create
EntityListController::listing public function Provides the listing page for any entity type.
EntityListController::__construct public function Creates an EntityListController object.