You are here

public function FontawesomeIconpicker::settingsForm in Font Awesome Iconpicker 8

Same name in this branch
  1. 8 src/Plugin/Field/FieldFormatter/FontawesomeIconpicker.php \Drupal\fontawesome_iconpicker\Plugin\Field\FieldFormatter\FontawesomeIconpicker::settingsForm()
  2. 8 src/Plugin/Field/FieldWidget/FontawesomeIconpicker.php \Drupal\fontawesome_iconpicker\Plugin\Field\FieldWidget\FontawesomeIconpicker::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 FormatterBase::settingsForm

File

src/Plugin/Field/FieldFormatter/FontawesomeIconpicker.php, line 38

Class

FontawesomeIconpicker
Plugin implementation of the 'fontawesome_iconpicker' formatter.

Namespace

Drupal\fontawesome_iconpicker\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $elements = [];
  $elements['size'] = [
    '#type' => 'select',
    '#title' => t('Icon Size'),
    '#description' => t('Select an icon size.'),
    '#default_value' => $this
      ->getSetting('size'),
    '#options' => $this
      ->getFaIconSizes(),
  ];
  return $elements;
}