function activity_configure_handler_form in Activity 7
Form builder for the Handler configuration.
1 string reference to 'activity_configure_handler_form'
- activity_menu in ./
activity.module - Implements hook_menu().
File
- ./
activity.admin.inc, line 80 - activity.admin.inc Contains administrative forms for activity.module
Code
function activity_configure_handler_form($form, $form_state, ActivityActionHandler $action) {
$form += array(
'#tree' => TRUE,
'options' => array(),
'messages' => array(),
'test' => array(),
'label' => array(
'#type' => 'textfield',
'#default_value' => $action->label,
'#title' => t('Label'),
'#weight' => -10,
),
);
$form_state += array(
'messages' => array(
'en' => array(
0 => 'Enter an Eid to test this message',
),
),
);
// Add in the handlers options and messages.
$action
->optionForm($form['options'], $form_state);
$action
->messagesForm($form['messages'], $form_state);
$table_id = 'activity-test-table';
$form['#actions_id'] = $action->actions_id;
$form['test'] = array(
'#prefix' => '<div class="container-inline">',
'#suffix' => '</div>',
'eid' => array(
'#type' => 'textfield',
'#title' => t('Enter the ID'),
'#default_value' => '',
'#size' => 5,
),
'additional_arguments' => array(
'argument1' => array(
'#type' => 'textfield',
'#title' => t('Argument 1'),
'#size' => 25,
),
'argument2' => array(
'#type' => 'textfield',
'#title' => t('Argument 2'),
'#size' => 25,
),
),
'submit_test' => array(
'#type' => 'submit',
'#value' => t('Test'),
'#submit' => array(
'activity_message_test_submit',
),
'#ajax' => array(
'callback' => 'activity_message_test_ajax_callback',
'wrapper' => $table_id,
),
),
);
$rows = array();
foreach ($form_state['messages'] as $lang => $messages) {
foreach ($messages as $uid => $message) {
$rows[] = array(
$lang,
$uid,
$message,
);
}
}
$form['message_results'] = array(
'#markup' => theme('table', array(
'header' => array(
t('Language'),
t('User id'),
t('Message'),
),
'rows' => $rows,
'attributes' => array(
'id' => $table_id,
),
)),
);
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
$form['save_update'] = array(
'#type' => 'submit',
'#value' => t('Save and Update Existing'),
'#access' => $action->batch && empty($_GET['new']),
);
$form['save_create'] = array(
'#type' => 'submit',
'#value' => t('Save and Create'),
'#access' => $action->batch && !empty($_GET['new']),
);
return $form;
}