You are here

function form_process_placeholder in Elements 6

Element process callback; adds support for the HTML5 placeholder attribute.

Parameters

$element: An associative array containing the properties of the element.

Return value

The processed element.

1 string reference to 'form_process_placeholder'
elements_elements in ./elements.module
Implements hook_elements().

File

./elements.module, line 144

Code

function form_process_placeholder($element) {
  if (isset($element['#placeholder']) && !isset($element['#attributes']['placeholder'])) {

    // If the placeholder FAPI property is set, simply add it to the form's
    // attributes so it will be output in the HTML tag.
    $element['#attributes']['placeholder'] = $element['#placeholder'];
  }
  return $element;
}