summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-11-06 21:54:28 -0700
committerBharat Mediratta <bharat@menalto.com>2010-11-06 21:54:28 -0700
commitd503513eca13c9c212d2772e9791744725127a8e (patch)
tree26389519be2cc373f36b75b70dadf23e38399937
parentf01fad1cd0661a7fee42d701b0c17dd8f4def576 (diff)
Create item_before_create and item_before_update events, and make
Item_Model::data_file public. This allows us to intercept and tweak data files before saving the model which enables the max_size module.
-rw-r--r--modules/gallery/models/item.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index d16a5dc4..eaf09c9c 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -20,7 +20,7 @@
class Item_Model_Core extends ORM_MPTT {
protected $children = "items";
protected $sorting = array();
- protected $data_file = null;
+ public $data_file = null;
public function __construct($id=null) {
parent::__construct($id);
@@ -320,6 +320,7 @@ class Item_Model_Core extends ORM_MPTT {
$this->updated = time();
if (!$this->loaded()) {
// Create a new item.
+ module::event("item_before_create", $this);
// Set a weight if it's missing. We don't do this in the constructor because it's not a
// simple assignment.
@@ -398,6 +399,7 @@ class Item_Model_Core extends ORM_MPTT {
module::event("item_created", $this);
} else {
// Update an existing item
+ module::event("item_before_update", $item);
// If any significant fields have changed, load up a copy of the original item and
// keep it around.