You are here

function message_action_create_message_instance_form in Message 6

Action: Create a message instance configuration form.

File

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

Code

function message_action_create_message_instance_form($settings, &$form, $form_state) {
  $form['settings']['arguments'] = array(
    '#type' => 'textarea',
    '#title' => t('Arguments'),
    '#default_value' => !empty($settings['arguments']) ? $settings['arguments'] : '',
    '#description' => t('The replacement arguments. Each argument should be in a separate line. <code>@node|node/1</code>.'),
  );
  $sample = t("return array(\n '@link' => array('callback' => 'url', 'callback arguments' => array(\"node/\$node->nid\")),\n '@title' => \$node->title,\n);");
  $form['settings']['code'] = array(
    '#type' => 'textarea',
    '#title' => t('Arguments by code'),
    '#default_value' => $settings['code'],
    '#rows' => 5,
    '#description' => t('Advanced usage only: PHP code that returns the value to set. Should not include &lt;?php ?&gt; delimiters. If this field is filled out, the value returned by this code will override any value specified above in "Arguments". Expected format: <pre>@sample</pre>.', array(
      '@sample' => $sample,
    )),
  );
  $form['settings']['entity_type'] = array(
    '#type' => 'textfield',
    '#title' => t('Entity type'),
    '#default_value' => !empty($settings['entity_type']) ? $settings['entity_type'] : '',
    '#description' => t('Optional; The type of entity being acted upon (e.g. node, user).'),
  );
  $form['settings']['eid'] = array(
    '#type' => 'textfield',
    '#title' => t('Entity ID'),
    '#default_value' => !empty($settings['eid']) ? $settings['eid'] : '',
    '#description' => t('Optional; Entity ID used to maintain the relationship between the message and the entity that is related to it.'),
  );
  $form['settings']['extra_identifier'] = array(
    '#type' => 'textfield',
    '#title' => t('Extra identifier'),
    '#default_value' => !empty($settings['extra_identifier']) ? $settings['extra_identifier'] : '',
    '#description' => t('Optional; An identifier that can group message instances together.'),
  );
}