Пример #1
0
 function render()
 {
     if (!$this->source_set) {
         if (!$this->model->loaded()) {
             throw $this->exception('Specified model must be loaded');
         }
         $data = array();
         foreach ($this->model->elements as $key => $field) {
             if ($field instanceof Field) {
                 $data[] = array('id' => $key, 'name' => $field->caption(), 'value' => $field->get());
             }
         }
         parent::setSource($data);
     }
     return parent::render();
 }
Пример #2
0
 function render()
 {
     if (!$this->source_set) {
         if (!$this->model->loaded()) {
             throw $this->exception('Specified model must be loaded');
         }
         $data = array();
         foreach ($this->model->getActualFields() as $key) {
             $field = $this->model->hasElement($key);
             if (!$field) {
                 continue;
             }
             if ($field instanceof Field || $field instanceof Field_Base) {
                 $data[] = array('id' => $key, 'name' => $field->caption(), 'value' => $field->get());
             }
         }
         parent::setSource($data);
     }
     return parent::render();
 }