You are here

public function Contextual::settingsForm in Custom Formatters 8.3

Settings form callback.

Return value

array The form API array.

Overrides FormatterExtrasBase::settingsForm

File

src/Plugin/CustomFormatters/FormatterExtras/Contextual.php, line 30

Class

Contextual
Contextual links optional integration plugin.

Namespace

Drupal\custom_formatters\Plugin\CustomFormatters\FormatterExtras

Code

public function settingsForm() {
  $form = [];
  $form['mode'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Mode'),
    '#options' => [
      CUSTOM_FORMATTERS_EXTRAS_CONTEXTUAL_DISABLED => $this
        ->t('Disabled'),
      CUSTOM_FORMATTERS_EXTRAS_CONTEXTUAL_ENABLED => $this
        ->t('Enabled'),
    ],
    '#default_value' => $this->entity
      ->getThirdPartySetting('contextual', 'mode', CUSTOM_FORMATTERS_EXTRAS_CONTEXTUAL_ENABLED),
  ];
  return $form;
}