You are here

function homebox_save_page in Homebox 6.3

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

Helper function to save an existing page

Parameters

$page: A page object

$check: Whether or not we should check the page data first

Return value

Boolean status of the operation

3 calls to homebox_save_page()
homebox_admin_display_form_submit in ./homebox.admin.inc
Process main home blocks administration form submission.
homebox_admin_page_submit in ./homebox.admin.inc
homebox_configure_form_submit in ./homebox.admin.inc
Forms for administration settings

File

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

Code

function homebox_save_page($page, $check = FALSE) {
  if ($page->name && is_array($page->settings)) {

    // Should we check the page data?
    if ($check && !homebox_check_page_object($page)) {
      return FALSE;
    }

    // Delete page, if it exists
    db_query("DELETE FROM {homebox_pages} WHERE name = '%s'", $page->name);

    // Save the new/updated page
    if (!drupal_write_record('homebox_pages', $page)) {
      return FALSE;
    }
  }
  else {
    return FALSE;
  }
  return TRUE;
}