You are here

function _erl_layouts_get_mode_options in Entity Reference with Layout 8

Return the options availables for the widget.

Parameters

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

string|null $type: The type to get mode options for (example: 'class' or 'color').

Return value

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

1 call to _erl_layouts_get_mode_options()
erl_layouts_field_widget_third_party_settings_form in modules/erl_layouts/erl_layouts.module
Implements hook_field_widget_third_party_settings_form().

File

modules/erl_layouts/erl_layouts.module, line 195
Contains entity_reference_layout.module.

Code

function _erl_layouts_get_mode_options($key = NULL, $type = 'class') {
  $options = [
    'manual' => t('Users can set a @type manually', [
      '@type' => $type,
    ]),
    'select' => t('Let users select a @type from a list', [
      '@type' => $type,
    ]),
    'force' => t('Automatically add the specified @type', [
      '@type' => $type,
    ]),
  ];
  if ($key && isset($options[$key])) {
    return $options[$key];
  }
  return $options;
}