public function InteractiveFormatter::settingsForm in Facebook Instant Articles 8.2
Same name and namespace in other branches
- 3.x src/Plugin/Field/FieldFormatter/InteractiveFormatter.php \Drupal\fb_instant_articles\Plugin\Field\FieldFormatter\InteractiveFormatter::settingsForm()
Returns a form to configure settings for the formatter.
Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the formatter. The field_ui module takes care of handling submitted form values.
Parameters
array $form: The form where the settings form is being included in.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form elements for the formatter settings.
Overrides FormatterBase::settingsForm
1 call to InteractiveFormatter::settingsForm()
- InteractiveLinkFormatter::settingsForm in src/
Plugin/ Field/ FieldFormatter/ InteractiveLinkFormatter.php - Returns a form to configure settings for the formatter.
1 method overrides InteractiveFormatter::settingsForm()
- InteractiveLinkFormatter::settingsForm in src/
Plugin/ Field/ FieldFormatter/ InteractiveLinkFormatter.php - Returns a form to configure settings for the formatter.
File
- src/
Plugin/ Field/ FieldFormatter/ InteractiveFormatter.php, line 41
Class
- InteractiveFormatter
- Plugin implementation of the 'fbia_interactive' formatter.
Namespace
Drupal\fb_instant_articles\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$element['source_type'] = [
'#type' => 'select',
'#title' => $this
->t('Source type'),
'#description' => $this
->t('Add your tracker specifying the URL or embed the full unescaped HTML'),
'#default_value' => $this
->getSetting('source_type'),
'#options' => [
self::SOURCE_TYPE_URL => $this
->t('URL'),
self::SOURCE_TYPE_HTML => $this
->t('Embedded HTML'),
],
];
$element['width'] = [
'#type' => 'number',
'#title' => $this
->t('Width'),
'#description' => $this
->t('The width of your interactive graphic.'),
'#default_value' => $this
->getSetting('width'),
];
$element['height'] = [
'#type' => 'number',
'#title' => $this
->t('Height'),
'#description' => $this
->t('The height of your interactive graphic.'),
'#default_value' => $this
->getSetting('height'),
];
$element['margin'] = [
'#type' => 'select',
'#title' => t('Margin'),
'#description' => t('The margin setting of your intereactive graphic.'),
'#default_value' => $this
->getSetting('margin'),
'#options' => [
Interactive::NO_MARGIN => $this
->t('No margin'),
Interactive::COLUMN_WIDTH => t('Column width'),
],
];
return $element;
}