function paragraphs_previewer_form_entity_form_display_edit_form_alter in Paragraphs Previewer 8
Implements hook_form_entity_form_display_edit_form_alter().
File
- ./
paragraphs_previewer.module, line 61 - Provides a rendered preview of a paragraphs item on an entity form.
Code
function paragraphs_previewer_form_entity_form_display_edit_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
if (empty($form['fields'])) {
return;
}
$field_names = Element::children($form['fields']);
if (empty($field_names)) {
return;
}
// Remove DEPRECATED plugin id from the widget type options list.
$deprecated_id = 'paragraphs_previwer';
foreach ($field_names as $field_name) {
if (!empty($form['fields'][$field_name]['plugin']['type']['#options'][$deprecated_id])) {
unset($form['fields'][$field_name]['plugin']['type']['#options'][$deprecated_id]);
}
}
}