You are here

public function SocialLinkWidget::settingsForm in Social Link Field 8

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/SocialLinkWidget.php, line 101

Class

SocialLinkWidget
Plugin implementation of the 'open_hours' widget.

Namespace

Drupal\social_link_field\Plugin\Field\FieldWidget

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $element = [];
  if ($this->cardinality > 0) {
    $element['select_social'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Possibility to select social network'),
      '#default_value' => $this
        ->getSetting('select_social'),
    ];
  }
  $element['disable_weight'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Forbidden to change weight'),
    '#default_value' => $this
      ->getSetting('disable_weight'),
  ];
  return $element;
}