コード例 #1
0
ファイル: Context.php プロジェクト: zingular/forms
 /**
  * @return string
  */
 public function getDataPath()
 {
     if (is_null($this->parent)) {
         return '';
     }
     return $this->parent->getDataPath();
 }
コード例 #2
0
ファイル: Form.php プロジェクト: zingular/forms
 /**
  * @param FormState $state
  * @param array $defaultValues
  */
 public function compile(FormState $state, array $defaultValues = array())
 {
     // TODO: make protected, and remove from all other components
     // TODO: loopt through all children and use fixed set of compilers to compile each child (recursively)
     // TODO: components are only models for data, no logic
     // prevent multiple compiles
     if ($this->compiled === false) {
         $this->compiled = true;
         // TODO: do CSRF check
         parent::compile($state, $defaultValues);
         // if form was submitted
         if ($this->hasSubmit()) {
             $this->dispatchEvent(new FormEvent(FormEvent::SUBMIT, $this));
         }
         // if form was successful
         if ($this->valid()) {
             // dispatch valid event
             $this->dispatchEvent(new FormEvent(FormEvent::VALID, $this));
         } else {
             // dispatch invalid event
             $this->dispatchEvent(new FormEvent(FormEvent::INVALID, $this));
         }
         // form was submitted and validated successfuly
         if ($this->success()) {
             // handle the orm model, if any
             if (!is_null($this->model)) {
                 $this->getOrmHandler()->setValues($this->getValues(), $this->model);
             }
             // dispatch success event
             $this->dispatchEvent(new FormEvent(FormEvent::SUCCESS, $this));
             // handle handlers
             // TODO: implement form handlers
         }
     }
 }
コード例 #3
0
 /**
  * @param Container $row
  */
 protected function buildRowPrototype(Container $row)
 {
     $row->setCssBaseTypeClass('row')->setViewName(View::ROW)->setComponentBaseType('row')->setErrorBuilder(Builder::ERROR);
 }
コード例 #4
0
ファイル: Aggregator.php プロジェクト: zingular/forms
 /**
  * @return array
  */
 protected function describeSelf()
 {
     return array_merge(parent::describeSelf(), array('aggregationStrategyType' => $this->aggregatorType));
 }