You are here

protected function EntityDisplayFormBase::getDisplays in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/field_ui/src/Form/EntityDisplayFormBase.php \Drupal\field_ui\Form\EntityDisplayFormBase::getDisplays()
  2. 9 core/modules/field_ui/src/Form/EntityDisplayFormBase.php \Drupal\field_ui\Form\EntityDisplayFormBase::getDisplays()

Returns entity (form) displays for the current entity display type.

Return value

\Drupal\Core\Entity\Display\EntityDisplayInterface[] An array holding entity displays or entity form displays.

2 calls to EntityDisplayFormBase::getDisplays()
EntityDisplayFormBase::getDisplayStatuses in core/modules/field_ui/src/Form/EntityDisplayFormBase.php
Returns form or view modes statuses for the bundle used by this form.
EntityDisplayFormBase::saveDisplayStatuses in core/modules/field_ui/src/Form/EntityDisplayFormBase.php
Saves the updated display mode statuses.

File

core/modules/field_ui/src/Form/EntityDisplayFormBase.php, line 824

Class

EntityDisplayFormBase
Base class for EntityDisplay edit forms.

Namespace

Drupal\field_ui\Form

Code

protected function getDisplays() {
  $load_ids = [];
  $display_entity_type = $this->entity
    ->getEntityTypeId();
  $entity_type = $this->entityTypeManager
    ->getDefinition($display_entity_type);
  $config_prefix = $entity_type
    ->getConfigPrefix();
  $ids = $this
    ->configFactory()
    ->listAll($config_prefix . '.' . $this->entity
    ->getTargetEntityTypeId() . '.' . $this->entity
    ->getTargetBundle() . '.');
  foreach ($ids as $id) {
    $config_id = str_replace($config_prefix . '.', '', $id);
    [
      ,
      ,
      $display_mode,
    ] = explode('.', $config_id);
    if ($display_mode != 'default') {
      $load_ids[] = $config_id;
    }
  }
  return $this->entityTypeManager
    ->getStorage($display_entity_type)
    ->loadMultiple($load_ids);
}