You are here

function termcase_form_taxonomy_form_term_alter in Termcase 7

Same name and namespace in other branches
  1. 8 termcase.module \termcase_form_taxonomy_form_term_alter()

Implements hook_form_FORM_ID_alter().

File

./termcase.module, line 21
The Termcase module gives you the option to specify specific case-formatting on terms.

Code

function termcase_form_taxonomy_form_term_alter(&$form, &$form_state) {
  $edit_link = t('You can change this setting on the <a href="@vocabulary_edit_link">vocabulary settings page</a>.', array(
    '@vocabulary_edit_link' => url('admin/structure/taxonomy/' . $form['#vocabulary']->machine_name . '/edit'),
  ));
  switch (_termcase_vocabulary_termcase($form['#vocabulary']->machine_name)) {
    case TERMCASE_UCFIRST:
      $form['name']['#description'] = t('Please note: the first letter of this term will be converted to <em>Uppercase</em>.') . ' ' . $edit_link;
      break;
    case TERMCASE_LOWERCASE:
      $form['name']['#description'] = t('Please note: the term will be converted to <em>lowercase</em>.') . ' ' . $edit_link;
      break;
    case TERMCASE_UPPERCASE:
      $form['name']['#description'] = t('Please note: the term will be converted to <em>UPPERCASE</em>.') . ' ' . $edit_link;
      break;
    case TERMCASE_PROPERCASE:
      $form['name']['#description'] = t('Please note: the term will be converted to <em>Proper Case</em>.') . ' ' . $edit_link;
      break;
  }
}