Taxonomy List in node/add Capitalize all letters in the parent only I have a strange customer request for a taxonomy list users select from while adding content.



The request from the customer is have the parent vid show up in ALL CAPS and the children to be left alone.

What's the best approach to this?
Thanks
You can use hook_form_alter to alter the node form. This way you don't alter the data in the vocabulary.

function modulename_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  // For 'article' content type.
  if ($form_id === 'article_node_form') {
    $lang_code = $form['language']['#value'];
    foreach ($form['field_dd'][$lang_code]['#options'] as $key =&gt; $value) {
      // Check if option starts with '-' sign. Only child starts with '-' sign.
      // If yes, then continue.
      if (strpos($value, '-') === 0) {
        continue;
      }
      // Else capitalize all the characters.
      $form['field_dd'][$lang_code]['#options'][$key] = strtoupper($value);
      // $form['field_dd'][$lang_code]['#options'][$key]['#attributes'] = array('class' =&gt; array('option-blue'));
    }
  }
}




Note:

Refer this link for your new use case: https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#attributes