hook_element_info_alter

hook_element_info_alter(array &$info)

Alter the element type information returned from modules.

A module may implement this hook in order to alter the element type defaults defined by a module.

Parameters

array $info: An associative array with structure identical to that of the return value of \Drupal\Core\Render\ElementInfoManagerInterface::getInfo().

See also

\Drupal\Core\Render\ElementInfoManager

\Drupal\Core\Render\Element\ElementInterface

Related topics

Hooks
Define functions that alter the behavior of Drupal core.

File

core/lib/Drupal/Core/Render/theme.api.php, line 798
Hooks and documentation related to the theme and render system.

Code

function hook_element_info_alter(array &$info) {
  // Decrease the default size of textfields.
  if (isset($info['textfield']['#size'])) {
    $info['textfield']['#size'] = 40;
  }
}
doc_Drupal
2016-10-29 09:17:54
Comments
Leave a Comment

Please login to continue.