You are here

function homebox_pages in Homebox 7.2

Same name and namespace in other branches
  1. 6.3 homebox.module \homebox_pages()
  2. 6 homebox.module \homebox_pages()
  3. 6.2 homebox.module \homebox_pages()
  4. 7.3 homebox.module \homebox_pages()

Retrieve an array of all available pages either in the database or by hook_homebox()

Return value

An array of page objects

5 calls to homebox_pages()
homebox_features_export_options in ./homebox.features.inc
Implements hook_features_export_options().
homebox_menu in ./homebox.module
Implements hook_menu().
homebox_og_group_settings_page in homebox_og/homebox_og.module
OG Homebox settings form
homebox_user_settings_page in ./homebox.admin.inc
Provide form for user profile settings
theme_homebox_admin_new_page in ./homebox.admin.inc
Theme the new-page form.
1 string reference to 'homebox_pages'
homebox_save_page in ./homebox.module
Helper function to save an existing page

File

./homebox.module, line 1350
Homebox main file, takes care of global functions settings constants, etc.

Code

function homebox_pages() {
  $pages = array();

  // Fetch all available pages from database
  $result = db_query("SELECT * FROM {homebox_pages} ORDER BY name");
  foreach ($result as $page) {
    $page->settings = unserialize($page->settings);
    $pages[] = $page;
  }

  // Fetch all available pages from API
  $result = module_invoke_all('homebox');
  foreach ($result as $name => $data) {

    // Build page object
    $page = new stdClass();
    $page->name = $name;
    $page->settings = $data;

    // Check the data before using it
    if ($page = homebox_check_page_object($page)) {
      $pages[] = $page;
    }
  }
  return empty($pages) ? NULL : $pages;
}