You are here

function flag_actions_token_actions_send_email_action_form in Flag 5

Same name and namespace in other branches
  1. 6.2 flag_actions.module \flag_actions_token_actions_send_email_action_form()
  2. 6 flag_actions.module \flag_actions_token_actions_send_email_action_form()

File

./flag_actions.module, line 527
Actions support for the Flag module.

Code

function flag_actions_token_actions_send_email_action_form(&$form, &$flag, $context) {
  if (!isset($context['recipient'])) {
    $form['recipient']['#default_value'] = '[site-mail]';
  }
  if (!isset($context['subject'])) {
    $form['subject']['#default_value'] = t('Content Flagged @flag_title', array(
      '@flag_title' => $flag
        ->get_title(),
    ));
  }
  if (!isset($context['message'])) {
    $form['message']['#default_value'] = t("The @flag_content_type [flag-content-title] has been flagged [flag-count] times with the @flag_title flag.\n\nView this @flag_content_type at [flag-content-url].", array(
      '@flag_content_type' => $flag->content_type,
      '@flag_title' => $flag
        ->get_title(),
    ));
  }
  $form['help'] = array(
    '#type' => 'fieldset',
    '#title' => t('Tokens'),
    '#description' => t('The following tokens can be used in the recipient, subject, or message.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['help']['basic'] = array(
    '#value' => theme('flag_token_help', array(
      'flag',
      'flag-action',
    )),
  );
  $form['help']['tokens'] = array(
    '#type' => 'fieldset',
    '#title' => t('More tokens'),
    '#description' => t("Depending on the type of the content being flagged, the following tokens can be used in the recipients, subject, or message. For example, if the content being flagged is a node, you can use any of the node tokens --but you can't use the comment tokens: they won't be recognized. Similarly, if the content being flagged is a user, you can use only the user tokens."),
    '#value' => theme('flag_token_help', $flag
      ->get_labels_token_types()),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
}