You are here

function homebox_pages in Homebox 6.3

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

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

Parameters

$api: Whether or not to invoke other modules for pages

Return value

An array of page objects

5 calls to homebox_pages()
homebox_features_export_options in ./homebox.features.inc
Implementation of hook_features_export_options().
homebox_menu in ./homebox.module
Implementation of 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
theme_homebox_admin_new_page in ./homebox.admin.inc
Theme the new-page form.
2 string references to 'homebox_pages'
homebox_save_page in ./homebox.module
Helper function to save an existing page
homebox_update_6002 in ./homebox.install
Replace page custom setting with a regular block.

File

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

Code

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

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

  // Fetch all available pages from API
  if ($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;
}