public function SkypeButtonFormatter::settingsForm in Skype 8
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
File
- src/
Plugin/ Field/ FieldFormatter/ SkypeButtonFormatter.php, line 58
Class
- SkypeButtonFormatter
- Plugin implementation of the 'skype_button' formatter.
Namespace
Drupal\skype\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$elements['actions'] = [
'#type' => 'checkboxes',
'#title' => t('Choose what you\'d like your button to do:'),
'#options' => [
'call' => t('Call'),
'chat' => t('Chat'),
],
'#default_value' => $this
->getSetting('actions'),
'#required' => TRUE,
];
$elements['image_color'] = [
'#type' => 'select',
'#title' => t('Choose how you want your button to look:'),
'#options' => [
'blue' => t('Blue'),
'white' => t('White'),
],
'#default_value' => $this
->getSetting('image_color'),
'#required' => TRUE,
];
$elements['image_size'] = [
'#type' => 'select',
'#title' => t('Choose the size of your button:'),
'#options' => [
10 => '10px',
12 => '12px',
14 => '14px',
16 => '16px',
24 => '24px',
32 => '32px',
],
'#default_value' => $this
->getSetting('image_size'),
'#required' => TRUE,
];
return $elements;
}