You are here

protected function LinkClassFieldWidget::getModeOptions in Link class 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Field/FieldWidget/LinkClassFieldWidget.php \Drupal\link_class\Plugin\Field\FieldWidget\LinkClassFieldWidget::getModeOptions()

Return the options availables for the widget.

Parameters

string|null $key: The optionnal key to retrieve.

Return value

array|mixed The options array or the value corresponding to $key.

2 calls to LinkClassFieldWidget::getModeOptions()
LinkClassFieldWidget::settingsForm in src/Plugin/Field/FieldWidget/LinkClassFieldWidget.php
Returns a form to configure settings for the widget.
LinkClassFieldWidget::settingsSummary in src/Plugin/Field/FieldWidget/LinkClassFieldWidget.php
Returns a short summary for the current widget settings.

File

src/Plugin/Field/FieldWidget/LinkClassFieldWidget.php, line 122

Class

LinkClassFieldWidget
Plugin implementation of the 'link_class_field_widget' widget.

Namespace

Drupal\link_class\Plugin\Field\FieldWidget

Code

protected function getModeOptions($key = NULL) {
  $options = [
    'force_class' => $this
      ->t('Class are automatically added'),
    'select_class' => $this
      ->t('Let users select a class from a list'),
    'manual' => $this
      ->t('Users can set a class manually'),
  ];
  if ($key && isset($options[$key])) {
    return $options[$key];
  }
  return $options;
}