예제 #1
0
 /**
  * Serialize the `body` property using its editor.
  */
 protected function lazy_get_properties()
 {
     global $core;
     $properties = parent::lazy_get_properties();
     if (isset($properties['body']) && isset($properties['editor'])) {
         $editor = $core->editors[$properties['editor']];
         $properties['body'] = $editor->serialize($properties['body']);
     }
     return $properties;
 }
예제 #2
0
 /**
  * For new records, the values for the {@link Page::SITEID} and {@link Page::LANGUAGE}
  * properties are obtained from the current site. If the weight of the page is not defined
  * it is computed according to the page having the same parent.
  */
 protected function lazy_get_properties()
 {
     global $core;
     $properties = parent::lazy_get_properties() + array(Page::PARENTID => 0);
     if (!$this->key) {
         /* @var $site \Icybee\Modules\Sites\Site */
         $site = $core->site;
         $siteid = $site->siteid;
         $properties[Page::SITEID] = $siteid;
         $properties[Page::LANGUAGE] = $site->language;
         if (empty($properties[Page::WEIGHT])) {
             $model = $this->module->model;
             if ($model->count()) {
                 $weight = $model->where('siteid = ? AND parentid = ?', $siteid, $properties[Page::PARENTID])->maximum('weight');
                 $properties[Page::WEIGHT] = $weight === null ? 0 : $weight + 1;
             } else {
                 $properties[Page::WEIGHT] = 0;
             }
         }
     }
     return $properties;
 }