You are here

function token_actions_goto_action_form in Token 6

Form builder; Prepare a form for a tokenized redirect action.

See also

token_actions_goto_action()

token_actions_goto_action_submit()

File

./token_actions.module, line 248
The Token Actions module.

Code

function token_actions_goto_action_form($context) {
  $context += array(
    'url' => '',
  );
  $form['url'] = array(
    '#type' => 'textfield',
    '#title' => t('URL'),
    '#description' => t('The URL to which the user should be redirected. This can be an internal URL like node/1234 or an external URL like http://drupal.org.'),
    '#default_value' => $context['url'],
    '#required' => TRUE,
    '#element_validate' => array(
      'token_element_validate',
    ),
    '#token_types' => array(
      'all',
    ),
  );
  $form['help'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Placeholder tokens'),
    '#description' => t("The following placeholder tokens can be used in the URL path. Some tokens may not be available, depending on the context in which the action is triggered."),
  );
  $form['help']['tokens'] = array(
    '#value' => theme('token_tree', 'all'),
  );
  return $form;
}