You are here

public function boxes_box::save in Boxes 6

Same name and namespace in other branches
  1. 7 plugins/boxes_box.inc \boxes_box::save()

Save a box.

File

plugins/boxes_box.inc, line 94

Class

boxes_box
Abstract base class defining a box. A boxes content plugin provides a form of options for configuring content and renders content for display.

Code

public function save() {
  if (empty($this->delta)) {
    throw new Exception(t('Cannot save box without a specified delta.'));
  }
  self::reset();
  $existing = boxes_load($this->delta);
  if ($existing && $existing->export_type & EXPORT_IN_DATABASE) {
    drupal_write_record('box', $this, array(
      'delta',
    ));
  }
  else {
    drupal_write_record('box', $this);
  }
  $this->new = FALSE;
  self::reset();
  module_exists('context') ? context_invalidate_cache() : NULL;
}