function pm_block_user_settings in Privatemsg 6.2
Same name and namespace in other branches
- 6 pm_block_user/pm_block_user.module \pm_block_user_settings()
- 7.2 pm_block_user/pm_block_user.admin.inc \pm_block_user_settings()
- 7 pm_block_user/pm_block_user.admin.inc \pm_block_user_settings()
Menu callback for blocked user settings.
1 string reference to 'pm_block_user_settings'
- pm_block_user_menu in pm_block_user/
pm_block_user.module - Implements hook_menu().
File
- pm_block_user/
pm_block_user.admin.inc, line 12 - Administration menu callbacks for pm_block_user.module.
Code
function pm_block_user_settings(&$form_state) {
drupal_add_css(drupal_get_path('module', 'pm_block_user') . '/pm_block_user.css');
// Need to cache form for AHAH, so it can be rebuilt from cache later.
$form = array(
'#cache' => TRUE,
);
// Container for just the actions, used for AHAH.
$form['block_actions'] = array(
'#tree' => TRUE,
'#prefix' => '<div id="block-actions">',
'#suffix' => '</div>',
'#theme' => 'pm_block_user_actions',
);
// Should we populate the form with data from $form_state or the database?
if (!isset($form_state['pm_block_user']['block_actions'])) {
$block_actions = variable_get('pm_block_user_actions', array());
}
else {
$block_actions = $form_state['pm_block_user']['block_actions'];
}
// Work through each rule, adding it as a new element in
// $form['block_actions'] ready to be themed later.
foreach ($block_actions as $delta => $details) {
$details['delta'] = $delta;
$form['block_actions'][$delta] = _pm_block_user_actions_form($details);
}
// The magic AHAH callback button that adds more rows.
$form['pm_block_actions_more'] = array(
'#type' => 'submit',
'#value' => t('More'),
'#weight' => 1,
'#prefix' => '<div id="add-rule-button">',
'#suffix' => '<label for="edit-pm-block-actions-more">' . t('Add new rule') . '</label></div>',
'#submit' => array(
'pm_block_user_more_submit',
),
'#ahah' => array(
'path' => 'messages/block/js',
'wrapper' => 'block-actions',
'method' => 'replace',
'effect' => 'fade',
),
);
$form['submit_form'] = array(
'#type' => 'submit',
'#weight' => 10,
'#value' => t('Save configuration'),
);
return $form;
}