You are here

public function LinkClassFormatter::settingsForm in Open Social 8.8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_core/src/Plugin/Field/FieldFormatter/LinkClassFormatter.php \Drupal\social_core\Plugin\Field\FieldFormatter\LinkClassFormatter::settingsForm()
  2. 10.3.x modules/social_features/social_core/src/Plugin/Field/FieldFormatter/LinkClassFormatter.php \Drupal\social_core\Plugin\Field\FieldFormatter\LinkClassFormatter::settingsForm()
  3. 10.0.x modules/social_features/social_core/src/Plugin/Field/FieldFormatter/LinkClassFormatter.php \Drupal\social_core\Plugin\Field\FieldFormatter\LinkClassFormatter::settingsForm()
  4. 10.1.x modules/social_features/social_core/src/Plugin/Field/FieldFormatter/LinkClassFormatter.php \Drupal\social_core\Plugin\Field\FieldFormatter\LinkClassFormatter::settingsForm()
  5. 10.2.x modules/social_features/social_core/src/Plugin/Field/FieldFormatter/LinkClassFormatter.php \Drupal\social_core\Plugin\Field\FieldFormatter\LinkClassFormatter::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 LinkFormatter::settingsForm

File

modules/social_features/social_core/src/Plugin/Field/FieldFormatter/LinkClassFormatter.php, line 34

Class

LinkClassFormatter
Plugin implementation of the 'link' formatter.

Namespace

Drupal\social_core\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $elements = parent::settingsForm($form, $form_state);
  $elements['class'] = [
    '#type' => 'textfield',
    '#title' => t('Class on Link'),
    '#default_value' => $this
      ->getSetting('class'),
  ];
  return $elements;
}