コード例 #1
0
ファイル: FormField.php プロジェクト: kyxer/barriosLaravel
 /**
  * @param             $name
  * @param             $type
  * @param Form        $parent
  * @param array       $options
  */
 public function __construct($name, $type, Form $parent, array $options = [])
 {
     $this->name = $name;
     $this->type = $type;
     $this->parent = $parent;
     $this->formHelper = $this->parent->getFormHelper();
     $this->setTemplate();
     $this->setDefaultOptions($options);
     $this->setupValue();
 }
コード例 #2
0
ファイル: FormField.php プロジェクト: adhikjoshi/D-provider
 /**
  * @param             $name
  * @param             $type
  * @param Form        $parent
  * @param array       $options
  */
 public function __construct($name, $type, Form $parent, array $options = [])
 {
     $this->name = $name;
     $this->type = $type;
     $this->parent = $parent;
     $this->formHelper = $this->parent->getFormHelper();
     $this->setTemplate();
     $this->setDefaultOptions($options);
     $defaultValue = $this->getOption($this->valueProperty);
     $isChild = $this->getOption('is_child');
     if ($defaultValue instanceof \Closure) {
         $this->valueClosure = $defaultValue;
     }
     if ((!$defaultValue || $defaultValue instanceof \Closure) && !$isChild) {
         $this->setValue($this->getModelValueAttribute($this->parent->getModel(), $name));
     } elseif (!$isChild) {
         $this->hasDefault = true;
     }
 }