コード例 #1
0
ファイル: FieldSet.php プロジェクト: gobline/form
 private function updateElementsNamespace($fieldSetName, AbstractComponent $component)
 {
     if ($component instanceof AbstractElement) {
         $name = $component->getAttribute('name');
         $pos = strpos($name, '[');
         if ($pos !== false) {
             $name = $fieldSetName . '[' . substr($name, 0, $pos) . ']' . substr($name, $pos);
         } else {
             $name = $fieldSetName . '[' . $name . ']';
         }
         $component->setAttribute('name', $name);
         return;
     }
     foreach ($component->getComponents() as $c) {
         $component->updateElementsNamespace($fieldSetName, $c);
     }
 }
コード例 #2
0
ファイル: AbstractElement.php プロジェクト: gobline/form
 public function __construct($name)
 {
     parent::__construct($name);
     $this->attributes['name'] = $name;
     $this->rules['value'] = 'required';
 }