You are here

public function FieldLayoutEntityDisplayFormTrait::getRegions in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/field_layout/src/Form/FieldLayoutEntityDisplayFormTrait.php \Drupal\field_layout\Form\FieldLayoutEntityDisplayFormTrait::getRegions()
  2. 10 core/modules/field_layout/src/Form/FieldLayoutEntityDisplayFormTrait.php \Drupal\field_layout\Form\FieldLayoutEntityDisplayFormTrait::getRegions()

Overrides \Drupal\field_ui\Form\EntityDisplayFormBase::getRegions().

File

core/modules/field_layout/src/Form/FieldLayoutEntityDisplayFormTrait.php, line 29

Class

FieldLayoutEntityDisplayFormTrait
Provides shared code for entity display forms.

Namespace

Drupal\field_layout\Form

Code

public function getRegions() {
  $regions = [];
  $layout_definition = $this->layoutPluginManager
    ->getDefinition($this
    ->getEntity()
    ->getLayoutId());
  foreach ($layout_definition
    ->getRegions() as $name => $region) {
    $regions[$name] = [
      'title' => $region['label'],
      'message' => $this
        ->t('No field is displayed.'),
    ];
  }
  $regions['hidden'] = [
    'title' => $this
      ->t('Disabled', [], [
      'context' => 'Plural',
    ]),
    'message' => $this
      ->t('No field is hidden.'),
  ];
  return $regions;
}