function paragraphs_previewer_field_widget_form in Paragraphs Previewer 7
Implements hook_field_widget_form().
Extends paragraphs_field_widget_form().
File
- ./
paragraphs_previewer.module, line 143 - Provides a rendered preview of a paragraphs item on an entity form..
Code
function paragraphs_previewer_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
$elements = array();
if ($instance['widget']['type'] == 'paragraphs_previewer_embed') {
// Set to closed if open.
if (isset($instance['settings']['default_edit_mode']) && $instance['settings']['default_edit_mode'] == 'open') {
$instance['settings']['default_edit_mode'] = 'closed';
}
// Build paragraphs form.
module_load_include('inc', 'paragraphs', 'paragraphs.field_widget');
$elements = paragraphs_field_multiple_value_form($field, $instance, $langcode, $items, $form, $form_state, $delta, $element);
}
return $elements;
}