You are here

public static function LanguageItem::settingsOptions in Custom Language field 8

Gets the unified keys for Formatter and Widget display settings.

Parameters

string $usage: Usage.

Return value

array Array of options.

4 calls to LanguageItem::settingsOptions()
LanguageFormatter::settingsForm in src/Plugin/Field/FieldFormatter/LanguageFormatter.php
Returns a form to configure settings for the formatter.
LanguageFormatter::settingsSummary in src/Plugin/Field/FieldFormatter/LanguageFormatter.php
Returns a short summary for the current formatter settings.
LanguageSelectWidget::settingsForm in src/Plugin/Field/FieldWidget/LanguageSelectWidget.php
Returns a form to configure settings for the widget.
LanguageSelectWidget::settingsSummary in src/Plugin/Field/FieldWidget/LanguageSelectWidget.php
Returns a short summary for the current widget settings.

File

src/Plugin/Field/FieldType/LanguageItem.php, line 79

Class

LanguageItem
Plugin implementation of the 'language' field type.

Namespace

Drupal\languagefield\Plugin\Field\FieldType

Code

public static function settingsOptions($usage = 'formatter') {
  $options = [];
  $t = \Drupal::translation();
  if (\Drupal::moduleHandler()
    ->moduleExists('languageicons')) {
    if ($usage != 'widget') {
      $options += [
        'icon' => $t
          ->translate('Language icon'),
      ];
    }
  }
  $options += [
    'iso' => $t
      ->translate('ISO 639-code'),
    'name' => $t
      ->translate('Name'),
    'name_native' => $t
      ->translate('Native name'),
  ];
  return $options;
}