EntityDisplayFormBase::saveDisplayStatuses

protected EntityDisplayFormBase::saveDisplayStatuses($display_statuses)

Saves the updated display mode statuses.

Parameters

array $display_statuses: An array holding updated form or view mode statuses.

File

core/modules/field_ui/src/Form/EntityDisplayFormBase.php, line 876

Class

EntityDisplayFormBase
Base class for EntityDisplay edit forms.

Namespace

Drupal\field_ui\Form

Code

protected function saveDisplayStatuses($display_statuses) {
  $displays = $this->getDisplays();
  foreach ($displays as $display) {
    // Only update the display if the status is changing.
    $new_status = $display_statuses[$display->get('mode')];
    if ($new_status !== $display->status()) {
      $display->set('status', $new_status);
      $display->save();
    }
  }
}
doc_Drupal
2016-10-29 09:05:26
Comments
Leave a Comment

Please login to continue.