コード例 #1
0
ファイル: Legend.php プロジェクト: corneltek/formkit
 function __construct($text = null, $attributes = array())
 {
     if ($text && is_string($text)) {
         $textNode = new DOMText($text);
         $this->addChild($textNode);
     }
     parent::__construct('legend', $attributes);
 }
コード例 #2
0
ファイル: Label.php プロジェクト: corneltek/formkit
 public function __construct($text = null)
 {
     if ($text) {
         if (!is_string($text)) {
             throw new Exception("The argument is not a string.");
         }
         $this->addChild(new DOMText($text));
     }
     parent::__construct('label');
 }
コード例 #3
0
ファイル: Form.php プロジェクト: corneltek/formkit
 public function __construct($attributes = array())
 {
     parent::__construct($this->tagName, $attributes);
 }
コード例 #4
0
ファイル: BaseWidget.php プロジェクト: corneltek/formkit
 /**
  *
  * @param string $name
  * @param array $attributes
  *
  *    valid attributes:
  *      - name
  *      - type
  *      - value
  *      - hint
  *      - tooltip
  *      - disabled
  *      - readonly
  *      - placeholder
  */
 public function __construct()
 {
     $args = func_get_args();
     $attributes = array();
     //  new FooInput('name',array( ...attributes ... ));
     if (2 === count($args)) {
         $this->name = $args[0];
         if ($args[1] && is_array($args[1])) {
             $attributes = $args[1];
         }
     } elseif (1 === count($args)) {
         $arg = $args[0];
         if (is_string($arg)) {
             $this->name = $arg;
         } elseif (is_array($arg)) {
             $attributes = $arg;
         } else {
             throw new InvalidArgumentException('Unsupported argument type');
         }
     }
     if (!$this->tagName) {
         throw new Exception("tagName is not defined in " . get_class($this));
     }
     parent::__construct($this->tagName, $attributes);
     // create element
 }
コード例 #5
0
ファイル: Hint.php プロジェクト: corneltek/formkit
 public function __construct($text)
 {
     $this->append($text);
     parent::__construct($this->tagName);
 }