You are here

function message_action_load_message_form in Message 6

Action: Load a message configuration form.

File

includes/message.rules_forms.inc, line 15
Rules configuration forms for the taxonomy module.

Code

function message_action_load_message_form($settings, &$form, $form_state) {
  $options = array();
  if ($messages = message_load()) {
    foreach ($messages as $message) {
      $options[$message->name] = check_plain($message->name);
      if (!empty($message->description)) {
        $options[$message->name] .= ' (' . check_plain($message->description) . ')';
      }
    }
  }
  $form['settings']['message'] = array(
    '#type' => 'fieldset',
    '#title' => t("Select a message"),
    '#description' => !empty($options) ? t('Select the message.') : t('There are no existing messages.'),
  );
  $form['settings']['message']['message_select'] = array(
    '#type' => 'select',
    '#title' => t('Message'),
    '#options' => $options,
    '#disabled' => empty($options),
  );
  $form['settings']['message']['message_text'] = array(
    '#type' => 'textarea',
    '#title' => t('Select by message id'),
    '#default_value' => !empty($settings['message']['message_text']) ? $settings['message']['message_text'] : '',
    '#disabled' => empty($options),
    '#description' => t('Optional: enter the message name that should be loaded . If this field is used "Select a message" field will be ignored.'),
  );
}