function _form_set_class


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 _form_set_class(&$element, $class = array())
cle7 _form_set_class(&$element, $class = array())
elmsmedia7 _form_set_class(&$element, $class = array())
icor7 _form_set_class(&$element, $class = array())
meedjum_blog7 _form_set_class(&$element, $class = array())
mooc7 _form_set_class(&$element, $class = array())

Sets a form element's class attribute.

Adds 'required' and 'error' classes as needed.


$element: The form element.

$name: Array of new class names to be added.

Related topics

16 calls to _form_set_class()
corolla_fieldset in sites/all/themes/ulmus/corolla/template.php
Returns HTML for a fieldset form element and its children.
tao_preprocess_fieldset in sites/all/themes/ulmus/tao/template.php
Implementation of preprocess_fieldset().
tao_textarea in sites/all/themes/ulmus/tao/template.php
Override of theme('textarea'). Deprecate misc/textarea.js in favor of using the 'resize' CSS3 property.
theme_checkbox in includes/
Returns HTML for a checkbox form element.
theme_feeds_upload in sites/all/modules/ulmus/feeds/
Theme upload widget.

... See full list


includes/, line 4207
Functions for form and batch generation and processing.


function _form_set_class(&$element, $class = array()) {
  if (!empty($class)) {
    if (!isset($element['#attributes']['class'])) {
      $element['#attributes']['class'] = array();
    $element['#attributes']['class'] = array_merge($element['#attributes']['class'], $class);
  // This function is invoked from form element theme functions, but the
  // rendered form element may not necessarily have been processed by
  // form_builder().
  if (!empty($element['#required'])) {
    $element['#attributes']['class'][] = 'required';
  if (isset($element['#parents']) && form_get_error($element) !== NULL && !empty($element['#validated'])) {
    $element['#attributes']['class'][] = 'error';