You are here

function token_form_alter in Token 7

Implements hook_form_alter().

Adds a submit handler to forms which could affect the tokens available on the site.

File

./token.module, line 229
Enhances the token API in core: adds a browseable UI, missing tokens, etc.

Code

function token_form_alter(&$form, $form_state, $form_id) {
  switch ($form_id) {

    // Profile field forms.
    case 'profile_field_form':
    case 'profile_field_delete':

    // User picture form.
    case 'user_admin_settings':

    // System date type form.
    // @todo Remove when http://drupal.org/node/1173706 is fixed.
    case 'system_add_date_format_type_form':
    case 'system_delete_date_format_type_form':
      $form += array(
        '#submit' => array(),
      );
      array_unshift($form['#submit'], 'token_clear_cache');
      break;
  }
}