You are here

function token_actions_message_action_form in Token 6

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

See also

token_actions_message_action()

token_actions_message_action_submit()

File

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

Code

function token_actions_message_action_form($context) {
  $context += array(
    'message' => '',
  );
  $form['message'] = array(
    '#type' => 'textarea',
    '#title' => t('Message'),
    '#default_value' => $context['message'],
    '#required' => TRUE,
    '#rows' => '8',
    '#description' => t('The message to be displayed to the current user.'),
    '#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 custom message text. 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;
}