function FieldLayoutEntityDisplayFormTrait::getRegions

Same name in other branches
  1. 8.9.x 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()
  3. 11.x 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;
}

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