You are here

function token_form_system_actions_configure_alter in Token 7

Implements hook_form_FORM_ID_alter().

Alters the configure action form to add token context validation and adds the token tree for a better token UI and selection.

File

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

Code

function token_form_system_actions_configure_alter(&$form, $form_state) {
  $action = actions_function_lookup($form['actions_action']['#value']);
  switch ($action) {
    case 'system_message_action':
    case 'system_send_email_action':
    case 'system_goto_action':
      $form['token_tree'] = array(
        '#theme' => 'token_tree',
        '#token_types' => 'all',
        '#dialog' => TRUE,
        '#weight' => 100,
      );

      // @todo Add token validation to the action fields that can use tokens.
      break;
  }
}