You are here

public function EntityViewDisplayEditForm::getRegions in Facebook Instant Articles 3.x

Same name and namespace in other branches
  1. 8.2 src/Form/EntityViewDisplayEditForm.php \Drupal\fb_instant_articles\Form\EntityViewDisplayEditForm::getRegions()

Get the regions needed to create the overview form.

Return value

array Example usage:

return array(
  'content' => array(
    // label for the region.
    'title' => $this
      ->t('Content'),
    // Indicates if the region is visible in the UI.
    'invisible' => TRUE,
    // A message to indicate that there is nothing to be displayed in
    // the region.
    'message' => $this
      ->t('No field is displayed.'),
  ),
);

Overrides EntityDisplayFormBase::getRegions

File

src/Form/EntityViewDisplayEditForm.php, line 22

Class

EntityViewDisplayEditForm
Extends the core EntityViewDisplayEditForm to support multiple regions.

Namespace

Drupal\fb_instant_articles\Form

Code

public function getRegions() {
  $regions = parent::getRegions();
  if ($this
    ->getEntity()
    ->getOriginalMode() === 'fb_instant_articles') {
    $new_regions[Regions::REGION_HEADER] = [
      'title' => $this
        ->t('Header'),
      'message' => $this
        ->t('No fields are displayed in this region.'),
    ];
    $new_regions[Regions::REGION_CONTENT] = [
      'title' => $this
        ->t('Body'),
      'message' => $this
        ->t('No fields are displayed in this region.'),
    ];
    $new_regions[Regions::REGION_FOOTER] = [
      'title' => $this
        ->t('Footer'),
      'message' => $this
        ->t('No fields are displayed in this region.'),
    ];
    $new_regions['hidden'] = $regions['hidden'];
    $regions = $new_regions;
  }
  return $regions;
}