You are here

function name_get_custom_format_options in Name Field 8

Same name and namespace in other branches
  1. 6 name.module \name_get_custom_format_options()
  2. 7 name.module \name_get_custom_format_options()

Helper function to generate a list of all defined custom formatting options.

3 calls to name_get_custom_format_options()
NameFieldBuilder::buildConfigurationForm in src/Plugin/diff/Field/NameFieldBuilder.php
Form constructor.
NameFormatter::settingsForm in src/Plugin/Field/FieldFormatter/NameFormatter.php
Returns a form to configure settings for the formatter.
NameItem::fieldSettingsForm in src/Plugin/Field/FieldType/NameItem.php
Returns a form for the field-level settings.

File

./name.module, line 286
Defines an API for displaying and inputing names.

Code

function name_get_custom_format_options() {
  $options = [];
  foreach (\Drupal::entityTypeManager()
    ->getStorage('name_format')
    ->loadMultiple() as $format) {
    $options[$format
      ->id()] = $format
      ->label();
  }
  natcasesort($options);
  return $options;
}