You are here

function homebox_save_page in Homebox 7.2

Same name and namespace in other branches
  1. 6.3 homebox.module \homebox_save_page()
  2. 6.2 homebox.module \homebox_save_page()
  3. 7.3 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

4 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
Submit function for the admin page form.
homebox_clone_page_submit in ./homebox.admin.inc
Submit callback for clone form.
homebox_configure_form_submit in ./homebox.admin.inc
Forms for administration settings

File

./homebox.module, line 923
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_delete('homebox_pages')
      ->condition('name', $page->name)
      ->execute();

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

  // Clear cached value.
  drupal_static('homebox_get_page', array(), TRUE);
  return TRUE;
}