You are here

function maxlength_element_info_alter in Maxlength 7.3

Same name and namespace in other branches
  1. 8 maxlength.module \maxlength_element_info_alter()

Implements hook_element_info_alter().

File

./maxlength.module, line 37
Limit the number of characters in textfields and textareas and shows the amount of characters left.

Code

function maxlength_element_info_alter(&$cache) {

  // Add prerender functions to textareas and text fields.
  $cache['textfield']['#pre_render'][] = 'maxlength_pre_render';
  $cache['textarea']['#pre_render'][] = 'maxlength_pre_render';
  $cache['textarea']['#process'][] = 'maxlength_process_element';
  $cache['text_format']['#pre_render'][] = 'maxlength_pre_render';
  $cache['text_format']['#process'][] = 'maxlength_process_element';
}