You are here

public function YoastSeoWidget::settingsForm in Real-time SEO for Drupal 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldWidget/YoastSeoWidget.php \Drupal\yoast_seo\Plugin\Field\FieldWidget\YoastSeoWidget::settingsForm()

Returns a form to configure settings for the widget.

Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the widget. 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 definition for the widget settings.

Overrides WidgetBase::settingsForm

File

src/Plugin/Field/FieldWidget/YoastSeoWidget.php, line 195

Class

YoastSeoWidget
Advanced widget for yoast_seo field.

Namespace

Drupal\yoast_seo\Plugin\Field\FieldWidget

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $form = parent::settingsForm($form, $form_state);
  $form['edit_title'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable title editing'),
    '#description' => $this
      ->t('When this is checked the page title will be editable through the Real-Time SEO widget.'),
    '#default_value' => $this
      ->getSetting('edit_title'),
  ];
  $form['edit_description'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable description editing'),
    '#description' => $this
      ->t('When this is checked the meta description will be editable through the Real-Time SEO widget.'),
    '#default_value' => $this
      ->getSetting('edit_description'),
  ];
  return $form;
}