You are here

public function PreviewFactory::getEnabledDisplayModes in View Modes Display 8.2

Returns array of enabled displays.

Parameters

array $displays: Entity displays.

Return value

array Array of enabled display modes.

1 call to PreviewFactory::getEnabledDisplayModes()
PreviewFactory::preview in src/Service/PreviewFactory.php
Preview entity view modes.

File

src/Service/PreviewFactory.php, line 101

Class

PreviewFactory
Class PreviewFactory.

Namespace

Drupal\view_modes_display\Service

Code

public function getEnabledDisplayModes(array $displays) {
  $enabledDisplayModes = [];
  foreach ($displays as $display) {
    if ($display
      ->status()) {
      $enabledDisplayModes[] = $display
        ->get('mode');
    }
  }
  if (FALSE == array_key_exists('full', $enabledDisplayModes)) {
    $enabledDisplayModes[] = 'full';
  }
  return $enabledDisplayModes;
}