You are here

function _noderelationships_element_append_class in Node Relationships 6

Append a class to a form element.

1 call to _noderelationships_element_append_class()
_noderelationships_parent_node_form_scanner_recursive in ./noderelationships.pages.inc
Scan the form recursively to append CSS classes to node reference fields.

File

./noderelationships.pages.inc, line 686
Implementation of user land pages.

Code

function _noderelationships_element_append_class(&$element, $class_name) {
  if (!isset($element['#attributes'])) {
    $element['#attributes'] = array();
  }
  if (!isset($element['#attributes']['class'])) {
    $element['#attributes']['class'] = $class_name;
  }
  elseif (strpos($element['#attributes']['class'], $class_name) === FALSE) {
    $element['#attributes']['class'] .= ' ' . $class_name;
  }
}