You are here

function name_widget_layouts in Name Field 8

Helper function to get any defined name widget layout options.

Return value

array Keyed array of the name widget layout options.

2 calls to name_widget_layouts()
Name::preRender in src/Element/Name.php
This function themes the element and controls the title display.
NameFormDisplaySettingsTrait::getDefaultNameFormDisplaySettingsForm in src/Traits/NameFormDisplaySettingsTrait.php
Returns a form for the default settings defined above.

File

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

Code

function name_widget_layouts() {
  $layouts =& drupal_static(__FUNCTION__);
  if (!$layouts) {
    $cid = 'name:widget_layouts';
    if ($cache = \Drupal::cache()
      ->get($cid)) {
      $layouts = $cache->data;
    }
    else {
      $layouts = \Drupal::moduleHandler()
        ->invokeAll('name_widget_layouts');
      foreach ($layouts as &$layout) {
        $layout += [
          'library' => [],
          'wrapper_attributes' => [],
        ];
        $layout['wrapper_attributes']['class'][] = 'name-widget-wrapper';
      }
      \Drupal::cache()
        ->set($cid, $layouts);
    }
  }
  return $layouts;
}