function _jammer_generic_admin_settings in Jammer 6
Same name and namespace in other branches
- 7 jammer_generic.module \_jammer_generic_admin_settings()
Implementation of menu callback.
1 string reference to '_jammer_generic_admin_settings'
- jammer_generic_menu in ./
jammer_generic.module - Implementation of hook_menu().
File
- ./
jammer_generic.module, line 37 - Remove configured form elements from forms.
Code
function _jammer_generic_admin_settings() {
$form = array();
$form['jammer_generic_element_id_info'] = array(
'#type' => 'item',
'#value' => t('Before you use this module, please be sure you completely understand what you\'re doing. ' . 'Review the information available at !drupal_url. Generic Jammer will go through each ' . 'part of a form recursively setting !access_url, so make sure you have accounted for any side effects of ' . 'removing the form elements you plan to remove. This includes making sure there are default values for the ' . 'element if needed and removing any dependant javascript that may rely on the element being there. Always test ' . 'before releasing changes to a live production site.', array(
'!drupal_url' => l('Form API Quickstart Guide', 'http://drupal.org/node/751826'),
'!access_url' => l('#access', 'http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html#access'),
)),
);
$form['jammer_generic_form_id'] = array(
'#type' => 'textfield',
'#title' => t('Form id'),
'#required' => TRUE,
'#description' => t('The form id containing the element you want to remove. Node form ids are of format: nodetypename_node_form'),
);
$form['jammer_generic_element_id'] = array(
'#type' => 'textfield',
'#title' => t('Element id'),
'#required' => TRUE,
'#description' => t('The element id of the element you want to remove.'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Jam element',
);
$current_settings = variable_get('jammer_generic_elements', array());
$headers = array(
t('Form ID'),
t('Element ID'),
t('Delete'),
);
$data = array();
foreach ($current_settings as $key => $value) {
$data[] = array(
$value['jammer_generic_form_id'],
$value['jammer_generic_element_id'],
l(t('Delete'), 'admin/settings/jammer/generic/delete/' . $key),
);
}
if (!empty($data)) {
$form['configured'] = array(
'#type' => 'fieldset',
'#title' => 'Jammed form elements',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['configured']['table'] = array(
'#type' => 'item',
'#value' => theme('table', $headers, $data),
);
}
return $form;
}