You are here

public function FieldConfigListBuilder::load in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/field_ui/src/FieldConfigListBuilder.php \Drupal\field_ui\FieldConfigListBuilder::load()
  2. 9 core/modules/field_ui/src/FieldConfigListBuilder.php \Drupal\field_ui\FieldConfigListBuilder::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.

Return value

\Drupal\Core\Entity\EntityInterface[] An array of entities implementing \Drupal\Core\Entity\EntityInterface indexed by their IDs. Returns an empty array if no matching entities are found.

Overrides ConfigEntityListBuilder::load

File

core/modules/field_ui/src/FieldConfigListBuilder.php, line 105

Class

FieldConfigListBuilder
Provides lists of field config entities.

Namespace

Drupal\field_ui

Code

public function load() {
  $entities = array_filter($this->entityFieldManager
    ->getFieldDefinitions($this->targetEntityTypeId, $this->targetBundle), function ($field_definition) {
    return $field_definition instanceof FieldConfigInterface;
  });

  // Sort the entities using the entity class's sort() method.
  // See \Drupal\Core\Config\Entity\ConfigEntityBase::sort().
  uasort($entities, [
    $this->entityType
      ->getClass(),
    'sort',
  ]);
  return $entities;
}