function sms_actions_edit_command_form in SMS Framework 7
Same name and namespace in other branches
- 6.2 modules/sms_actions/sms_actions.module \sms_actions_edit_command_form()
- 6 modules/sms_actions/sms_actions.module \sms_actions_edit_command_form()
Form constructor for the sms_actions command editing form.
Parameters
string $discriminator: Determines which command is to be edited. Null for an empty form.
Return value
array Drupal form array.
See also
sms_actions_edit_command_form_validate()
sms_actions_edit_command_form_submit()
1 string reference to 'sms_actions_edit_command_form'
- sms_actions_menu in modules/
sms_actions/ sms_actions.module - Implementation of hook_menu().
File
- modules/
sms_actions/ sms_actions.module, line 417 - Provides a "Send SMS" action and the ability to define custom triggers for incoming messages.
Code
function sms_actions_edit_command_form($form, &$form_state, $discriminator = NULL) {
// Check for confirmation forms.
if (isset($form_state['confirm_delete'])) {
return sms_actions_command_confirm_delete($form_state, $discriminator);
}
if (isset($discriminator)) {
$command = sms_actions_command_load($discriminator);
}
$form['discriminator'] = array(
'#type' => 'textfield',
'#title' => t('Discriminator'),
'#description' => t('A keyword that will be used to identify incoming messages. The discriminator may consist only of lowercase letters, numbers, and dashes.'),
'#size' => 40,
'#maxlength' => 16,
'#required' => TRUE,
'#default_value' => isset($command) ? $command->discriminator : '',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save command'),
);
if (isset($command)) {
$form['old_discriminator'] = array(
'#type' => 'value',
'#value' => $command->discriminator,
);
$form['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete'),
'#weight' => 45,
);
}
return $form;
}