function ConfigEntityBundleBase::loadDisplays

Same name in other branches
  1. 9 core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php \Drupal\Core\Config\Entity\ConfigEntityBundleBase::loadDisplays()
  2. 8.9.x core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php \Drupal\Core\Config\Entity\ConfigEntityBundleBase::loadDisplays()
  3. 10 core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php \Drupal\Core\Config\Entity\ConfigEntityBundleBase::loadDisplays()

Returns view or form displays for this bundle.

Parameters

string $entity_type_id: The entity type ID of the display type to load.

Return value

\Drupal\Core\Entity\Display\EntityDisplayInterface[] A list of matching displays.

1 call to ConfigEntityBundleBase::loadDisplays()
ConfigEntityBundleBase::deleteDisplays in core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php
Deletes display if a bundle is deleted.

File

core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php, line 104

Class

ConfigEntityBundleBase
A base class for config entity types that act as bundles.

Namespace

Drupal\Core\Config\Entity

Code

protected function loadDisplays($entity_type_id) {
    
    /** @var \Drupal\Core\Config\Entity\ConfigEntityStorageInterface $storage */
    $storage = $this->entityTypeManager()
        ->getStorage($entity_type_id);
    $ids = $storage->getQuery()
        ->condition('id', $this->getEntityType()
        ->getBundleOf() . '.' . $this->getOriginalId() . '.', 'STARTS_WITH')
        ->execute();
    if ($ids) {
        $storage = $this->entityTypeManager()
            ->getStorage($entity_type_id);
        return $storage->loadMultiple($ids);
    }
    return [];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.