EntityDisplayFormBase::getDisplays

protected 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.

File

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

Class

EntityDisplayFormBase
Base class for EntityDisplay edit forms.

Namespace

Drupal\field_ui\Form

Code

protected function getDisplays() {
  $load_ids = array();
  $display_entity_type = $this->entity->getEntityTypeId();
  $entity_type = $this->entityManager->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);
    list(, , $display_mode) = explode('.', $config_id);
    if ($display_mode != 'default') {
      $load_ids[] = $config_id;
    }
  }
  return $this->entityManager->getStorage($display_entity_type)->loadMultiple($load_ids);
}
doc_Drupal
2016-10-29 09:05:23
Comments
Leave a Comment

Please login to continue.