public function Box::save in Boxes 7.2
Override the save to add clearing of caches
Overrides Entity::save
File
- includes/
boxes.core.inc, line 316 - Box classes and plugin interface
Class
- Box
- The Box entity class
Code
public function save() {
// Set the delta if it's not set already
if (empty($this->delta)) {
$max_length = 32;
// Base it on the label and make sure it isn't too long for the database.
$this->delta = drupal_clean_css_identifier(strtolower($this->label));
$this->delta = substr($this->delta, 0, $max_length);
// Check if delta is unique.
if (boxes_load_delta($this->delta)) {
$i = 0;
$separator = '-';
$original_delta = $this->delta;
do {
$unique_suffix = $separator . $i++;
$this->delta = substr($original_delta, 0, $max_length - drupal_strlen($unique_suffix)) . $unique_suffix;
} while (boxes_load_delta($this->delta));
}
}
$this->plugin
->submit($this);
$return = parent::save();
block_flush_caches();
cache_clear_all('boxes:' . $this->delta . ':', 'cache_block', TRUE);
return $return;
}