Drupal 8  8.0.2
EntityListBuilder Class Reference
Inheritance diagram for EntityListBuilder:

Public Member Functions

 __construct (EntityTypeInterface $entity_type, EntityStorageInterface $storage)
 
 getStorage ()
 
 load ()
 
 getOperations (EntityInterface $entity)
 
 buildHeader ()
 
 buildRow (EntityInterface $entity)
 
 buildOperations (EntityInterface $entity)
 
 render ()
 
- Public Member Functions inherited from EntityHandlerBase
 setModuleHandler (ModuleHandlerInterface $module_handler)
 

Static Public Member Functions

static createInstance (ContainerInterface $container, EntityTypeInterface $entity_type)
 

Protected Member Functions

 getEntityIds ()
 
 getLabel (EntityInterface $entity)
 
 getDefaultOperations (EntityInterface $entity)
 
 getTitle ()
 
- Protected Member Functions inherited from EntityHandlerBase
 moduleHandler ()
 

Protected Attributes

 $storage
 
 $entityTypeId
 
 $entityType
 
 $limit = 50
 
- Protected Attributes inherited from EntityHandlerBase
 $moduleHandler
 

Detailed Description

Defines a generic implementation to build a listing of entities.

Constructor & Destructor Documentation

__construct ( EntityTypeInterface  $entity_type,
EntityStorageInterface  $storage 
)

Constructs a new EntityListBuilder object.

Parameters
\Drupal\Core\Entity\EntityTypeInterface$entity_typeThe entity type definition.
\Drupal\Core\Entity\EntityStorageInterface$storageThe entity storage class.

References EntityTypeInterface\id().

Here is the call graph for this function:

Member Function Documentation

buildHeader ( )

Builds the header row for the entity listing.

Returns
array A render array structure of header strings.
See Also
::render()

References t().

Referenced by EntityListBuilder\render().

Here is the call graph for this function:

Here is the caller graph for this function:

buildOperations ( EntityInterface  $entity)

Builds a renderable list of operation links for the entity.

Parameters
\Drupal\Core\Entity\EntityInterface$entityThe entity on which the linked operations will be performed.
Returns
array A renderable array of operation links.
See Also
::buildRow()

References EntityListBuilder\getOperations().

Referenced by ConfigTranslationBlockListBuilder\buildRow(), and EntityListBuilder\buildRow().

Here is the call graph for this function:

Here is the caller graph for this function:

buildRow ( EntityInterface  $entity)

Builds a row for an entity in the entity listing.

Parameters
\Drupal\Core\Entity\EntityInterface$entityThe entity for this row of the list.
Returns
array A render array structure of fields for this entity.
See Also
::render()

References EntityListBuilder\buildOperations().

Referenced by EntityListBuilder\render().

Here is the call graph for this function:

Here is the caller graph for this function:

static createInstance ( ContainerInterface  $container,
EntityTypeInterface  $entity_type 
)
static

{Instantiates a new instance of this entity handler.This is a factory method that returns a new instance of this object. The factory should pass any needed dependencies into the constructor of this object, but not the container itself. Every call to this method must return a new instance of this object; that is, it may not implement a singleton.

Parameters
\Symfony\Component\DependencyInjection\ContainerInterface$containerThe service container this object should use.
\Drupal\Core\Entity\EntityTypeInterface$entity_typeThe entity type definition.
Returns
static A new instance of the entity handler.
}

Implements EntityHandlerInterface.

References EntityTypeInterface\get(), and EntityTypeInterface\id().

Here is the call graph for this function:

getDefaultOperations ( EntityInterface  $entity)
protected

Gets this list's default operations.

Parameters
\Drupal\Core\Entity\EntityInterface$entityThe entity the operations are for.
Returns
array The array structure is identical to the return value of self::getOperations().

References AccessibleInterface\access(), EntityInterface\hasLinkTemplate(), t(), and EntityInterface\urlInfo().

Referenced by EntityListBuilder\getOperations().

Here is the call graph for this function:

Here is the caller graph for this function:

getEntityIds ( )
protected

Loads entity IDs using a pager sorted by the entity id.

Returns
array An array of entity IDs.

References EntityListBuilder\getStorage().

Referenced by ConfigEntityListBuilder\load(), and EntityListBuilder\load().

Here is the call graph for this function:

Here is the caller graph for this function:

getLabel ( EntityInterface  $entity)
protected

Gets the label of an entity.

Parameters
\Drupal\Core\Entity\EntityInterface$entityThe entity being listed.
Returns
string The entity label.
Deprecated:
in Drupal 8.0.x, will be removed before Drupal 9.0.0 Use $entity->label() instead. This method used to escape the entity label. The render system's autoescape is now relied upon.

References EntityInterface\label().

Referenced by EntityDisplayModeListBuilder\render().

Here is the call graph for this function:

Here is the caller graph for this function:

getOperations ( EntityInterface  $entity)

{Provides an array of information to build a list of operation links.

Parameters
\Drupal\Core\Entity\EntityInterface$entityThe entity the operations are for.
Returns
array An associative array of operation link data for this list, keyed by operation name, containing the following key-value pairs:
  • title: The localized title of the operation.
  • url: An instance of for the operation URL.
  • weight: The weight of this operation.
}

Implements EntityListBuilderInterface.

References EntityListBuilder\getDefaultOperations(), and EntityHandlerBase\moduleHandler().

Referenced by EntityListBuilder\buildOperations().

Here is the call graph for this function:

Here is the caller graph for this function:

getStorage ( )

{Gets the entity storage.

Returns
The storage used by this list builder.
}

Implements EntityListBuilderInterface.

Referenced by EntityListBuilder\getEntityIds(), and BlockListBuilder\getEntityIds().

Here is the caller graph for this function:

getTitle ( )
protected

Gets the title of the page.

Returns
string A string title of the page.

Referenced by EntityListBuilder\render().

Here is the caller graph for this function:

load ( )

{Loads entities of this type from storage for listing.This allows the implementation to manipulate the listing, like filtering or sorting the loaded entities.

Returns
[] An array of entities implementing .
}

Implements EntityListBuilderInterface.

References EntityListBuilder\getEntityIds().

Referenced by EntityListBuilder\render().

Here is the call graph for this function:

Here is the caller graph for this function:

render ( )

{Builds a listing of entities for the given entity type.

Returns
array A render array as expected by drupal_render().
}

Builds the entity listing as renderable array for table.html.twig.

Todo:
Add a link to add a new item to the #empty text.

Implements EntityListBuilderInterface.

References EntityListBuilder\buildHeader(), EntityListBuilder\buildRow(), EntityListBuilder\getTitle(), EntityListBuilder\load(), and t().

Here is the call graph for this function:


The documentation for this class was generated from the following file: