function custompage_ui_admin_settings_form in Custom Page 6
Same name and namespace in other branches
- 7 custompage_ui/custompage_ui.module \custompage_ui_admin_settings_form()
1 string reference to 'custompage_ui_admin_settings_form'
- custompage_ui_menu in custompage_ui/
custompage_ui.module - @file Custom Page Admin UI
File
- custompage_ui/
custompage_ui.module, line 104 - Custom Page Admin UI
Code
function custompage_ui_admin_settings_form(&$form_state, $saved = null) {
$saved = is_null($saved) ? new StdClass() : $saved;
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => $saved->title,
'#size' => 50,
'#maxlength' => 50,
'#description' => t('Title of the custom page or a custom block.'),
);
$form['key'] = array(
'#type' => 'textfield',
'#title' => t('Key'),
'#default_value' => $saved->key,
'#required' => TRUE,
'#size' => 50,
'#maxlength' => 50,
'#description' => t('Please indicate a unique key for this page or block. Template file and theme functions used
for rendering will be named according to this key.<p><b>ATTENTION:</b> Do NOT use dash "-" in key names!</p>'),
);
$default_type = empty($saved->type) ? 'Page' : $saved->type;
$form['type'] = array(
'#type' => 'select',
'#title' => t('Type'),
'#default_value' => $saved->type,
'#options' => array(
'page' => t('Page'),
'block' => t('Block'),
),
'#required' => TRUE,
'#description' => t('Whether to create a page or a block.'),
);
$form['path'] = array(
'#type' => 'textfield',
'#title' => t('URI Path'),
'#default_value' => $saved->path,
'#required' => FALSE,
'#size' => 50,
'#maxlength' => 50,
'#description' => t('Only applicable if type is page: A Drupal URI path (relative to the root URI of Drupal) that this page should
show up at. N/A for blocks.'),
);
$form['enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Enabled'),
'#default_value' => isset($saved->enabled) ? $saved->enabled : True,
'#description' => t('You can disable a page/block during development. Only users with \'administer custompage\' permission can access the page when it is disabled.'),
);
if (trim($saved->key) != "") {
drupal_set_title(t('Edit custom page/block: %title', array(
'%title' => $saved->title,
)));
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#submit' => array(
'custompage_ui_settings_submit',
),
);
}
else {
drupal_set_title(t('Add a Custom Page/Block'));
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Add Component'),
'#submit' => array(
'custompage_ui_settings_submit',
),
);
}
return $form;
}