You are here

protected function ContentModelUpdater::hideEntityFormPath in Panopoly 8.2

Hides the path element for the entity forms.

Parameters

string $id: The form display ID.

1 call to ContentModelUpdater::hideEntityFormPath()
ContentModelUpdater::hideEntityFormPaths in modules/panopoly/panopoly_media/src/Update/ContentModelUpdater.php
Hides the path element for the entity forms of a given type.

File

modules/panopoly/panopoly_media/src/Update/ContentModelUpdater.php, line 428

Class

ContentModelUpdater
Applies changes to media content model from schema versions 8204 to 8205.

Namespace

Drupal\panopoly_media\Update

Code

protected function hideEntityFormPath($id) {
  if (!($formDisplay = EntityFormDisplay::load($id))) {
    return;
  }
  $content = $formDisplay
    ->get('content');
  $hidden = $formDisplay
    ->get('hidden');
  if (isset($content['path'])) {
    unset($content['path']);
  }
  if ($this
    ->getModuleHandler()
    ->moduleExists('path')) {
    $hidden['path'] = TRUE;
  }
  else {
    if (isset($hidden['path'])) {
      unset($hidden['path']);
    }
  }
  $formDisplay
    ->set('content', $content);
  $formDisplay
    ->set('hidden', $hidden);
  $formDisplay
    ->save();
}