You are here

protected function ViewStorageController::attachDisplays in Views (for Drupal 7) 8.3

Add defaults to the display options.

Parameters

Drupal\Core\Entity\EntityInterface $entity:

2 calls to ViewStorageController::attachDisplays()
ViewStorageController::attachLoad in lib/Drupal/views/ViewStorageController.php
Overrides Drupal\config\ConfigStorageController::attachLoad();
ViewStorageController::create in lib/Drupal/views/ViewStorageController.php
Overrides Drupal\config\ConfigStorageController::create().

File

lib/Drupal/views/ViewStorageController.php, line 96
Definition of Drupal\views\ViewStorageController.

Class

ViewStorageController
Defines the storage controller class for ViewStorage entities.

Namespace

Drupal\views

Code

protected function attachDisplays(EntityInterface $entity) {
  if (isset($entity->display) && is_array($entity->display)) {
    $displays = array();
    foreach ($entity
      ->get('display') as $key => $options) {
      $options += array(
        'display_options' => array(),
        'display_plugin' => NULL,
        'id' => NULL,
        'display_title' => '',
        'position' => NULL,
      );

      // Add the defaults for the display.
      $displays[$key] = $options;
    }
    $entity
      ->set('display', $displays);
  }
}