You are here

function language_element_info_alter in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/language/language.module \language_element_info_alter()

Implements hook_element_info_alter().

See also

\Drupal\Core\Render\Element\LanguageSelect

\Drupal\Core\Render\Element\Select

File

core/modules/language/language.module, line 121
Add language handling functionality to Drupal.

Code

function language_element_info_alter(&$type) {

  // Alter the language_select element so that it will be rendered like a select
  // field.
  if (isset($type['language_select'])) {
    if (!isset($type['language_select']['#process'])) {
      $type['language_select']['#process'] = array();
    }
    if (!isset($type['language_select']['#theme_wrappers'])) {
      $type['language_select']['#theme_wrappers'] = array();
    }
    $type['language_select']['#process'] = array_merge($type['language_select']['#process'], array(
      'language_process_language_select',
      array(
        'Drupal\\Core\\Render\\Element\\Select',
        'processSelect',
      ),
      array(
        'Drupal\\Core\\Render\\Element\\RenderElement',
        'processAjaxForm',
      ),
    ));
    $type['language_select']['#theme'] = 'select';
    $type['language_select']['#theme_wrappers'] = array_merge($type['language_select']['#theme_wrappers'], array(
      'form_element',
    ));
    $type['language_select']['#languages'] = LanguageInterface::STATE_CONFIGURABLE;
    $type['language_select']['#multiple'] = FALSE;
  }
}