public function ParagraphsBrowserWidgetTrait::settingsForm in Paragraphs Browser 8
File
- src/
Plugin/ Field/ FieldWidget/ ParagraphsBrowserWidgetTrait.php, line 35 - Paragraphs Previewer widget trait implementation for paragraphs.
Class
- ParagraphsBrowserWidgetTrait
- Trait of Plugin implementation of the 'entity_reference paragraphs' widget.
Namespace
Drupal\paragraphs_browser\Plugin\Field\FieldWidgetCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$elements = parent::settingsForm($form, $form_state);
$elements['add_mode'] = array(
'#type' => 'hidden',
'#value' => 'paragraphs_browser',
);
$paragraph_browsers = \Drupal::entityTypeManager()
->getStorage('paragraphs_browser_type')
->loadMultiple();
$options = array(
'_na' => 'No Groups',
);
foreach ($paragraph_browsers as $type) {
$options[$type->id] = $type->label;
}
$elements['paragraphs_browser'] = array(
'#type' => 'select',
'#title' => $this
->t('Paragraphs Browser'),
'#description' => $this
->t('Select which browser to use.'),
'#options' => $options,
'#default_value' => $this
->getSetting('paragraphs_browser'),
'#required' => TRUE,
);
$elements['modal_width'] = array(
'#type' => 'textfield',
'#title' => $this
->t('Paragraphs Browser Modal Width'),
'#description' => 'The width of the modal in px or percentage.',
'#default_value' => $this
->getSetting('modal_width'),
'#required' => FALSE,
);
$elements['modal_height'] = array(
'#type' => 'textfield',
'#title' => $this
->t('Paragraphs Browser Modal Height'),
'#description' => 'The height of the modal in px or "auto".',
'#default_value' => $this
->getSetting('modal_height'),
'#required' => FALSE,
);
return $elements;
}