public function ViewsContactFormEmailFormatter::settingsForm in Views Contact Form 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
- lib/
Drupal/ views_contact_form/ Plugin/ Field/ FieldFormatter/ ViewsContactFormEmailFormatter.php, line 96 - Definition of Drupal\views_contact_form\Plugin\field\formatter\ViewsContactFormEmailFormatter.
Class
- ViewsContactFormEmailFormatter
- Plugin implementation of the 'ViewsContactFormEmailFormatter' formatter
Namespace
Drupal\views_contact_form\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, array &$form_state) {
$categories = entity_load_multiple('contact_category');
foreach ($categories as $id => $category) {
$options[$id] = $category->label;
}
$form['category'] = array(
'#title' => 'Choose the category',
'#type' => 'select',
'#options' => $options,
'#default_value' => $this
->getSetting('category'),
);
$form['category_recipients_include'] = array(
'#title' => 'Category recipient(s)',
'#description' => 'Should we also send the mail to the default category recipient(s) ?',
'#type' => 'checkbox',
'#default_value' => $this
->getSetting('category_recipients_include'),
);
$form['form_display'] = array(
'#title' => 'Form display',
'#markup' => 'You can customize the display of the form by editing the ' . 'category form display. Click on the corresponding link: ' . '<em>Manage form display</em> on ' . l('this page', 'admin/structure/contact', array(
'attributes' => array(
'target' => '_blank',
),
)),
'#type' => 'item',
);
return $form;
}