function homebox_get_page in Homebox 7.3
Same name and namespace in other branches
- 6.3 homebox.module \homebox_get_page()
- 6.2 homebox.module \homebox_get_page()
- 7.2 homebox.module \homebox_get_page()
Helper function to fetch a page from the database or from a module implementing hook_homebox()
Parameters
$name: The machine name of the page
Return value
A page object, or FALSE is one doesn't exist with given $name
8 calls to homebox_get_page()
- homebox_admin_display_form_submit in ./
homebox.admin.inc - Process main home blocks administration form submission.
- homebox_admin_flush_form_submit in ./
homebox.admin.inc - Submit homebox_admin_flush_form()
- homebox_admin_page_submit in ./
homebox.admin.inc - Submit function for the admin page form.
- homebox_configure_form_submit in ./
homebox.admin.inc - Forms for administration settings
- homebox_features_export_render in ./
homebox.features.inc - Implements hook_features_export_render().
2 string references to 'homebox_get_page'
- homebox_delete_page in ./
homebox.module - Helper function to delete a page
- homebox_save_page in ./
homebox.module - Helper function to save an existing page
File
- ./
homebox.module, line 875 - Homebox main file, takes care of global functions settings constants, etc.
Code
function homebox_get_page($name) {
$names =& drupal_static(__FUNCTION__, array());
if (isset($names[$name])) {
return $names[$name];
}
// Fetch page from db
$page = db_query("SELECT * FROM {homebox_pages} WHERE name = :name", array(
':name' => $name,
))
->fetchObject();
if (is_object($page)) {
// Unserialize the settings
$page->settings = unserialize($page->settings);
$names[$name] = $page;
return $page;
}
else {
// If not available, check other modules
$pages = module_invoke_all('homebox');
foreach ($pages as $id => $data) {
// Only match page name
if ($name == $id) {
// Build page object
$page = new stdClass();
$page->name = $id;
$page->settings = $data;
// Check the data before using it
$page = homebox_check_page_object($page);
}
}
$names[$name] = is_object($page) ? $page : FALSE;
return $names[$name];
}
}