language_element_info_alter

language_element_info_alter(&$type)

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;
  }
}
doc_Drupal
2016-10-29 09:23:01
Comments
Leave a Comment

Please login to continue.