diff options
-rw-r--r-- | modules/gallery/models/item.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index e929f30d..395ba52c 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -26,7 +26,8 @@ class Item_Model extends ORM_MPTT { "title" => array("rules" => array("length[0,255]", "required")), "slug" => array("rules" => array("length[0,255]", "required")), "description" => array("rules" => array("length[0,65535]")), - "parent_id" => array("rules" => array("Item_Model::valid_parent")) + "parent_id" => array("rules" => array("Item_Model::valid_parent")), + "type" => array("rules" => array("Item_Model::valid_type")), ); /** @@ -737,6 +738,13 @@ class Item_Model extends ORM_MPTT { } /** + * Make sure that the type is valid. + */ + static function valid_type($value) { + return in_array($value, array("album", "photo", "movie")); + } + + /** * Make sure that the parent id refers to an album. */ static function valid_parent($value) { |