protected function ContentModelUpdater::updateFormDisplay in Panopoly 8.2
Update configuration for entity form displays.
Parameters
string $id: The form display ID.
1 call to ContentModelUpdater::updateFormDisplay()
- ContentModelUpdater::installFormDisplays in modules/
panopoly/ panopoly_media/ src/ Update/ ContentModelUpdater.php - Install form displays.
File
- modules/
panopoly/ panopoly_media/ src/ Update/ ContentModelUpdater.php, line 308
Class
- ContentModelUpdater
- Applies changes to media content model from schema versions 8204 to 8205.
Namespace
Drupal\panopoly_media\UpdateCode
protected function updateFormDisplay($id) {
$formDisplay = EntityFormDisplay::load($id);
switch ($id) {
case 'media.panopoly_media_file.default':
$content = $formDisplay
->get('content');
$hidden = $formDisplay
->get('hidden');
$this
->changeNestedValue($content, 'field_media_file::weight', 26, 0);
$this
->changeNestedValue($content, 'field_panopoly_media_description::weight', 27, 1);
$this
->changeNestedValue($content, 'field_panopoly_media_tags::weight', 28, 2);
$this
->unsetNestedValue($content, 'name');
$this
->setNestedValue($hidden, 'name', TRUE);
$formDisplay
->set('content', $content);
$formDisplay
->set('hidden', $hidden);
$formDisplay
->save();
break;
case 'media.panopoly_media_file.entity_browser':
$content = $formDisplay
->get('content');
$hidden = $formDisplay
->get('hidden');
$formDisplay
->set('content', $content);
$formDisplay
->set('hidden', $hidden);
$formDisplay
->save();
break;
case 'media.panopoly_media_image.default':
$content = $formDisplay
->get('content');
$hidden = $formDisplay
->get('hidden');
$this
->changeNestedValue($content, 'field_media_image::weight', 26, 0);
$this
->changeNestedValue($content, 'field_panopoly_media_description::weight', 27, 1);
$this
->changeNestedValue($content, 'field_panopoly_media_tags::weight', 28, 2);
$this
->unsetNestedValue($content, 'name');
$this
->setNestedValue($hidden, 'name', TRUE);
$formDisplay
->set('content', $content);
$formDisplay
->set('hidden', $hidden);
$formDisplay
->save();
break;
case 'media.panopoly_media_image.entity_browser':
$content = $formDisplay
->get('content');
$hidden = $formDisplay
->get('hidden');
$this
->changeNestedValue($content, 'field_media_image::weight', 1, 0);
$this
->changeNestedValue($content, 'field_panopoly_media_description::weight', 2, 1);
$this
->changeNestedValue($content, 'field_panopoly_media_tags::weight', 3, 2);
$this
->unsetNestedValue($content, 'name');
$this
->setNestedValue($hidden, 'name', TRUE);
$formDisplay
->set('content', $content);
$formDisplay
->set('hidden', $hidden);
$formDisplay
->save();
break;
case 'media.panopoly_media_remote_video.default':
$content = $formDisplay
->get('content');
$hidden = $formDisplay
->get('hidden');
$this
->changeNestedValue($content, 'field_media_oembed_video::weight', 26, 0);
$this
->changeNestedValue($content, 'field_panopoly_media_description::weight', 27, 1);
$this
->changeNestedValue($content, 'field_panopoly_media_tags::weight', 28, 2);
$this
->unsetNestedValue($content, 'name');
$this
->setNestedValue($hidden, 'name', TRUE);
$formDisplay
->set('content', $content);
$formDisplay
->set('hidden', $hidden);
$formDisplay
->save();
break;
case 'media.panopoly_media_remote_video.entity_browser':
$content = $formDisplay
->get('content');
$hidden = $formDisplay
->get('hidden');
$this
->changeNestedValue($content, 'field_media_oembed_video::weight', 1, 0);
$this
->changeNestedValue($content, 'field_panopoly_media_description', NULL, [
'region' => 'content',
'settings' => [
'placeholder' => '',
'rows' => 9,
'summary_rows' => 3,
],
'third_party_settings' => [],
'type' => 'text_textarea_with_summary',
'weight' => 1,
]);
$this
->unsetNestedValue($hidden, 'field_panopoly_media_description');
$content['field_panopoly_media_tags'] = [
'region' => 'content',
'settings' => [
'match_operator' => 'CONTAINS',
'placeholder' => '',
'size' => 60,
],
'third_party_settings' => [],
'type' => 'entity_reference_autocomplete_tags',
'weight' => 2,
];
$this
->unsetNestedValue($hidden, 'field_panopoly_media_tags');
$this
->unsetNestedValue($content, 'name');
$this
->setNestedValue($hidden, 'name', TRUE);
$formDisplay
->set('content', $content);
$formDisplay
->set('hidden', $hidden);
$formDisplay
->save();
break;
}
}