예제 #1
0
파일: Submit.php 프로젝트: gobline/form
 public function __construct($name)
 {
     parent::__construct($name);
     $this->attributes['type'] = 'submit';
     $this->attributes['value'] = '';
     $this->rules['value'] = 'optional';
 }
예제 #2
0
 /**
  * Constructor
  * Add a list item validator
  * @param Form_Field $field
  */
 public function __construct($field)
 {
     parent::__construct($field);
     $this->items = array();
     $validator = new \Foundation\Form\Validator\ChoiceInList($this, null);
     $this->addValidator($validator);
 }
예제 #3
0
파일: Input.php 프로젝트: popphp/pop-form
 /**
  * Constructor
  *
  * Instantiate the form input element, defaults to text
  *
  * @param  string $name
  * @param  string $type
  * @param  string $value
  * @param  string $indent
  * @return Input
  */
 public function __construct($name, $type = 'text', $value = null, $indent = null)
 {
     parent::__construct($this->type, null, null, false, $indent);
     $this->setAttributes(['type' => $type, 'name' => $name, 'id' => $name, 'value' => $value]);
     $this->setValue($value);
     $this->setName($name);
 }
예제 #4
0
파일: Checkbox.php 프로젝트: gobline/form
 public function __construct($name)
 {
     parent::__construct($name);
     $this->attributes['type'] = 'checkbox';
     $this->attributes['value'] = '1';
     $this->rules['value'] = 'optional';
 }
예제 #5
0
파일: Text.php 프로젝트: gobline/form
 public function __construct($name)
 {
     parent::__construct($name);
     $this->attributes['type'] = 'text';
     $this->attributes['value'] = '';
     $this->rules['value'] = 'required|trim';
 }
예제 #6
0
 /**
  * @param string $name
  * @param bool $abstract
  * @param string|PhpClass|null $extends
  * @param string[]|PhpClass[] $interfaces
  */
 public function __construct($name, $abstract = false, $extends = null, array $interfaces = array())
 {
     parent::__construct($name);
     $this->setAbstract($abstract);
     $this->setExtends($extends);
     $this->setInterfaces($interfaces);
 }
예제 #7
0
파일: InputArray.php 프로젝트: gobline/form
 public function __construct($name, $type = 'text')
 {
     parent::__construct($name);
     $this->attributes['type'] = $type;
     $this->attributes['value'] = [];
     $this->rules['value[]'] = 'required|trim';
 }
예제 #8
0
 public function __construct($size = 1)
 {
     if (is_string($size)) {
         $size = substr($size, 1, 1);
     }
     $this->tag = $this->tag . $size;
     parent::__construct();
 }
예제 #9
0
 /**
  * Constructor
  */
 public function __construct($field)
 {
     parent::__construct($field);
     $this->attributes['cols'] = 'cols';
     $this->attributes['rows'] = 'rows';
     $this->attributes['disabled'] = 'disabled';
     $this->attributes['readonly'] = 'readonly';
 }
예제 #10
0
 public function __construct($placeholder = null, $rows = null)
 {
     parent::__construct();
     if (isset($placeholder)) {
         parent::setAttribute((new Attribute('placeholder'))->append($placeholder));
     }
     if (isset($rows)) {
         parent::setAttribute((new Attribute('rows'))->append($rows));
     }
 }
예제 #11
0
 /**
  * Constructor
  * Make $value an array
  */
 public function __construct(\Foundation\Form\Field $field)
 {
     parent::__construct($field);
     $this->items = array();
     $this->value = array();
     $this->totalItems = false;
     $this->requiredItems = false;
     $validator = new \Foundation\Form\Validator\RankingList($this, null);
     $this->addValidator($validator);
 }
예제 #12
0
 public function __construct($href, $rel, $type = null)
 {
     parent::__construct();
     parent::setAttribute((new Attribute('href'))->append($href));
     parent::setAttribute((new Attribute('rel'))->append($rel));
     if (isset($type)) {
         parent:
         setAttribute((new Attribute('type'))->append($type));
     }
 }
예제 #13
0
 public function __construct($type, $name, $readonly = false, $disabled = false)
 {
     parent::__construct();
     parent::setAttribute('type', $type);
     parent::setAttribute('name', $name);
     if ($readonly) {
         parent::setAttribute((new Attribute('readonly'))->append('readonly'));
     }
     if ($disabled) {
         parent::setAttribute((new Attribute('disabled'))->append('disabled'));
     }
 }
예제 #14
0
 /**
  * Constructor
  * Check the API keys
  */
 public function __construct($field)
 {
     if (!self::$privateApiKey) {
         throw new \Foundation\Exception('Private API Key not set for reCAPTCHA library.');
     }
     if (!self::$publicApiKey) {
         throw new \Foundation\Exception('Public API Key not set for reCAPTCHA library.');
     }
     //move the static keys into local space for ease of use
     $this->publicKey = self::$publicApiKey;
     //use the secure server
     $this->server = self::API_SECURE_SERVER;
     parent::__construct($field);
     $this->addValidator(new \Foundation\Form\Validator\Captcha($this, self::$privateApiKey));
 }
예제 #15
0
 public function __construct($src = null, $type = null, $defer = false, $async = false)
 {
     parent::__construct();
     if (isset($src)) {
         parent::setAttribute((new Attribute('src'))->append($src));
     }
     if (isset($type)) {
         parent::setAttribute((new Attribute('type'))->append($type));
     }
     if ($defer) {
         parent::setAttribute((new Attribute('defer'))->append($defer));
     }
     if ($async) {
         parent::setAttribute((new Attribute('async'))->append($async));
     }
 }
예제 #16
0
파일: Button.php 프로젝트: popphp/pop-form
 /**
  * Constructor
  *
  * Instantiate the button form element.
  *
  * @param  string $name
  * @param  string $value
  * @param  string $indent
  * @return Button
  */
 public function __construct($name, $value = null, $indent = null)
 {
     parent::__construct($this->type, $value, null, false, $indent);
     $this->setAttributes(['name' => $name, 'id' => $name]);
     if (strtolower($name) == 'submit') {
         $this->setAttribute('type', 'submit');
     } else {
         if (strtolower($name) == 'reset') {
             $this->setAttribute('type', 'reset');
         } else {
             $this->setAttribute('type', 'button');
         }
     }
     $this->setValue($value);
     $this->setName($name);
 }
 /**
  * @param string $name
  * @param string $access
  */
 public function __construct($name, $access = self::ACCESS_PUBLIC)
 {
     parent::__construct($name);
     $this->setAccess($access);
 }
예제 #18
0
 public function __construct($data = array())
 {
     parent::__construct('input', $data);
 }
예제 #19
0
 /**
  * @param string $name
  * @param string $content
  * @param int $maxLength
  */
 public function __construct($name, $content, $maxLength = self::MAX_LENGTH)
 {
     parent::__construct($name);
     $this->setContent($content)->setMaxLength($maxLength);
 }
예제 #20
0
 public function __construct($datetime)
 {
     parent::__construct();
     parent::setAttribute((new Attribute('datetime'))->append($datetime));
 }
예제 #21
0
파일: Password.php 프로젝트: gobline/form
 public function __construct($name)
 {
     parent::__construct($name);
     $this->attributes['type'] = 'password';
     $this->attributes['value'] = '';
 }
예제 #22
0
 public function __construct($title)
 {
     parent::__construct();
     parent::setAttribute((new Attribute('title'))->append($title));
 }
예제 #23
0
파일: Textarea.php 프로젝트: gobline/form
 public function __construct($name)
 {
     parent::__construct($name);
     $this->rules['value'] = 'required|trim';
 }
예제 #24
0
 public function __construct($src)
 {
     parent::__construct();
     parent::setAttribute((new Attribute('src'))->append($src));
 }
예제 #25
0
 /**
  * @param array $annotations
  */
 public function __construct(array $annotations = array())
 {
     parent::__construct('_');
     $this->setAnnotations($annotations);
 }
예제 #26
0
파일: RadioGroup.php 프로젝트: gobline/form
 public function __construct($name)
 {
     parent::__construct($name);
 }
예제 #27
0
 public function __consturct(AbstractElement\DescriptionTerm $term = null, AbstractElement\DescriptionDefinition $definition = null)
 {
     parent::__construct();
     parent::add($term);
     parent::add($definition);
 }
예제 #28
0
 public function __construct($href)
 {
     parent::__construct();
     $this->setAttribute((new Attribute('href'))->append($href));
 }