Beispiel #1
0
 protected function beforeValidate()
 {
     $this->ancestorsBeforeValidate();
     $this->forSelectionBeforeValidate('reward_groups');
     $this->forSelectionBeforeValidate('expire_groups');
     return parent::beforeValidate();
 }
Beispiel #2
0
 protected function beforeValidate()
 {
     if (empty($this->slug)) {
         $this->slug = \Web::instance()->slug($this->namespace);
     }
     return parent::beforeValidate();
 }
Beispiel #3
0
 protected function beforeValidate()
 {
     if (empty($this->slug)) {
         $this->slug = \Web::instance()->slug($this->namespace);
     }
     // TODO Put this in beforeSave, to ensure that the slug is clean
     //$this->slug = \Web::instance()->slug( $this->slug );
     return parent::beforeValidate();
 }
Beispiel #4
0
 /**
  * 
  */
 protected function beforeValidate()
 {
     if (!empty($this->categories)) {
         $category_ids = array();
         $categories = array();
         $current = (array) $this->categories;
         $this->set('categories', array());
         // convert each into an array of values if they aren't already
         foreach ($current as $category) {
             if (is_array($category)) {
                 $categories[] = $category;
             } elseif (!empty($category)) {
                 $category_ids[] = $category;
             }
         }
         if (!empty($category_ids)) {
             if ($list = (new \Shop\Models\Categories())->setState('select.fields', array('title', 'slug'))->setState('filter.ids', $category_ids)->getList()) {
                 foreach ($list as $list_item) {
                     $cat = array('id' => $list_item->id, 'title' => $list_item->title, 'slug' => $list_item->slug);
                     $categories[] = $cat;
                 }
             }
         }
         $this->set('categories', $categories);
     }
     return parent::beforeValidate();
 }
 protected function beforeValidate()
 {
     return parent::beforeValidate();
 }
Beispiel #6
0
 protected function beforeValidate()
 {
     $this->imagesBeforeValidate();
     parent::beforeValidate();
 }