You are here

function twitter_actions_set_status_action_form in Twitter 6.2

Same name and namespace in other branches
  1. 6.5 twitter_actions/twitter_actions.module \twitter_actions_set_status_action_form()
  2. 6.3 twitter_actions/twitter_actions.module \twitter_actions_set_status_action_form()
  3. 6.4 twitter_actions/twitter_actions.module \twitter_actions_set_status_action_form()
  4. 7.6 twitter_actions/twitter_actions.module \twitter_actions_set_status_action_form()
  5. 7.3 twitter_actions/twitter_actions.module \twitter_actions_set_status_action_form()
  6. 7.4 twitter_actions/twitter_actions.module \twitter_actions_set_status_action_form()
  7. 7.5 twitter_actions/twitter_actions.module \twitter_actions_set_status_action_form()

Return a form definition so the Send email action can be configured.

Parameters

$context: Default values (if we are editing an existing action instance).

Return value

Form definition.

File

twitter_actions/twitter_actions.module, line 35
Exposes Drupal actions for sending Twitter messages.

Code

function twitter_actions_set_status_action_form($context = array()) {

  // Set default values for form.
  $context += array(
    'screen_name' => '',
    'password' => '',
    'message' => '',
    'node_types' => '',
  );
  $form['screen_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Twitter account name'),
    '#default_value' => $context['screen_name'],
    '#size' => 25,
    '#required' => TRUE,
  );
  $form['password'] = array(
    '#title' => t('Twitter password'),
    '#type' => 'password',
    '#size' => 25,
    '#required' => TRUE,
  );
  $node_types = node_get_types();
  $options = drupal_map_assoc(array_keys($node_types));
  $form['node_types'] = array(
    '#type' => 'select',
    '#title' => t('Node types'),
    '#options' => $options,
    '#description' => t('Nodes of these types will be tweeted (only applies if the trigger for this action is a content trigger).'),
    '#default_value' => $context['node_types'],
    '#required' => TRUE,
    '#multiple' => TRUE,
  );
  $form['message'] = array(
    '#type' => 'textarea',
    '#title' => t('Message'),
    '#default_value' => $context['message'],
    '#cols' => '80',
    '#rows' => '3',
    '#description' => t('The message that should be sent.'),
    '#required' => TRUE,
  );
  if (module_exists('token')) {
    $form['help'] = array(
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#title' => t('Placeholder tokens'),
      '#description' => t("The following placeholder tokens can be used in the status message. Some tokens may not be available, depending on the context in which the action is triggered. In addition, when node actions twigger this action, a special [shorturl] token can be used."),
    );
    $form['help']['tokens'] = array(
      '#value' => theme('token_help', 'all'),
    );
  }
  return $form;
}