function homebox_admin_page in Homebox 6
Same name and namespace in other branches
- 6.3 homebox.admin.inc \homebox_admin_page()
- 6.2 homebox.admin.inc \homebox_admin_page()
- 7.3 homebox.admin.inc \homebox_admin_page()
- 7.2 homebox.admin.inc \homebox_admin_page()
@file Home box admin file, takes care admin interface for homebox
Defines home box pages, default layout, settings
2 string references to 'homebox_admin_page'
- homebox_forms in ./
homebox.module - Implementation of hook_forms().
- homebox_menu in ./
homebox.module - Implementation of hook_menu().
File
- ./
homebox.admin.inc, line 10 - Home box admin file, takes care admin interface for homebox
Code
function homebox_admin_page() {
$pid = arg(4);
if ($pid) {
// Display the edit page form.
$page = db_fetch_object(db_query('SELECT * FROM {homebox_pages} WHERE pid = %d', $pid));
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Page name'),
'#default_value' => $page->name,
'#size' => 30,
'#required' => TRUE,
'#maxlength' => 64,
'#description' => t('The name for this page. Example: "dashboard", "editorial board", "site administrator".'),
);
// Path alias
if (module_exists('path')) {
$path = db_fetch_object(db_query("SELECT pid, dst FROM {url_alias} WHERE src = 'homebox/%d'", arg(4)));
$form['path'] = array(
'#type' => 'fieldset',
'#title' => t('URL path settings'),
'#collapsible' => TRUE,
'#collapsed' => is_null($path),
'#access' => user_access('create url aliases'),
'#weight' => 1,
);
$form['path']['path'] = array(
'#type' => 'textfield',
'#default_value' => $path->dst,
'#maxlength' => 128,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t('Optionally specify an alternative URL by which this page can be accessed. For example, type "dashboard" when creating a Dashboard page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'),
);
if ($path) {
$form['path']['pid'] = array(
'#type' => 'value',
'#value' => $path->pid,
);
}
}
else {
$form['path_module'] = array(
'#value' => '<p>' . t('If you had the Path module enabled, you could specify an URL alias for that page.') . '</p>',
);
}
$form['pid'] = array(
'#type' => 'value',
'#value' => $pid,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save page'),
'#weight' => 2,
);
$form['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete page'),
'#weight' => 3,
);
}
else {
$form['name'] = array(
'#type' => 'textfield',
'#size' => 32,
'#maxlength' => 64,
'#prefix' => theme('advanced_help_topic', 'homebox', 'new-page'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Add page'),
);
$form['#submit'][] = 'homebox_admin_page_submit';
$form['#validate'][] = 'homebox_admin_page_validate';
}
return $form;
}