public function render($attributes = null)
 {
     $attrs = $this->element->getAttributes();
     foreach ($attrs as $key => $value) {
         $this->htmlElement->setProperty($key, $value);
     }
     if (isset($attributes)) {
         $this->htmlElement->addProperties($attributes);
     }
     $this->htmlElement->setIdentifier($this->element->getName());
     $this->htmlElement->setValue($this->element->getValue());
     return $this->htmlElement->compile();
 }
Example #2
0
 /**
  * Final Cloneable field constructor with Decorator and ValidationExtender adding.
  *
  * @param string $name
  * @param null $attributes
  */
 public final function __construct($name, $attributes = null)
 {
     parent::__construct($name, $attributes);
     $templatePath = implode(DIRECTORY_SEPARATOR, [dirname(__FILE__), 'Cloneable', 'views', '']);
     $this->setDecorator(new Decorator($templatePath));
     $this->getDecorator()->setTemplateName('jquery');
     $this->addValidator(new ValidationExtender(array('cloneable' => $this)));
 }
Example #3
0
 /**
  * \Phalcon\Forms\Element constructor
  *
  * @param string $name
  * @param object|array|null $options
  * @param array|null $attributes
  * @throws Exception
  */
 public function __construct($name, $options = null, $attributes = null)
 {
     if (is_object($options) === false && is_array($options) === false && is_null($options) === false) {
         throw new Exception('Invalid parameter type.');
     }
     $this->_optionsValues = $options;
     parent::__construct($name, $attributes);
 }
Example #4
0
 public function __construct($name, $attributes = null)
 {
     parent::__construct($name, $attributes);
     $di = \Phalcon\Di::getDefault();
     $config = $di->get('config');
     $apis_config = $config->apis->toArray();
     if (empty($apis_config) || !isset($apis_config['recaptcha'])) {
         throw new \DF\Exception('Recaptcha is not configured in apis.conf.php!');
     }
     $this->config = $apis_config['recaptcha'];
 }
Example #5
0
 public function __construct($name, $options = array(), $attributes = null)
 {
     parent::__construct($name, $attributes);
     $this->_inner_form = new \Phalcon\Forms\Form();
     $this->_field_options = (array) $options;
     foreach ($this->_field_options as $check_key => $check_val) {
         $field_options = array('name' => $name . '[]', 'value' => $check_key);
         $element = new \Phalcon\Forms\Element\Check($name . '_' . $check_key, $field_options);
         $element->setLabel($check_val);
         $this->_inner_form->add($element);
     }
 }
Example #6
0
 public function __construct($name, $attributes = NULL, $icon = NULL)
 {
     $this->_icon = $icon;
     $this->_name = $name;
     if (!$attributes) {
         $attributes = [];
     }
     if (!isset($attributes['type'])) {
         $attributes['type'] = 'submit';
     }
     parent::__construct($name, $attributes);
 }
Example #7
0
 public function __construct($name)
 {
     parent::__construct($name);
     $this->path = 'files/';
     $this->name = $name;
     $this->maxFiles = 1;
     $this->uploadUrl = '/upload';
     $this->minFileSize = '1B';
     $this->maxFileSize = '10MB';
     $this->browserLabel = 'Select file';
     $this->browserType = self::BROWSER_BUTTON;
     $this->allowedExtensions = [];
     $this->forbiddenExtensions = [];
     $this->allowedMimeTypes = [];
     $this->forbiddenMimeTypes = [];
 }
 public function __construct($name, array $attributes = null)
 {
     parent::__construct($name, $attributes);
 }
Example #9
0
 /**
  * @param string $field_name
  *
  * @return array
  */
 private function _set_validators(Element &$element, $field_name)
 {
     $messages = $this->getCustomMessages();
     $rules_values = $this->getRules();
     $rules_values = isset($rules_values[$field_name]) ? $rules_values[$field_name] : null;
     if (!is_null($rules_values)) {
         $rules = explode('|', $rules_values);
     }
     if (!is_null($rules) && count($rules) > 0) {
         foreach ($rules as $rule) {
             $validator = $this->_get_validator($field_name, $rule, $messages);
             if (!is_null($validator)) {
                 $element->addValidator($validator);
             }
         }
     }
 }
Example #10
0
 public function __construct($name, $markup = null, $attributes = null)
 {
     parent::__construct($name, $attributes);
     $this->markup = $markup;
 }
Example #11
0
 public function __construct($name, $options = array(), $attributes = null)
 {
     parent::__construct($name, $attributes);
     $this->_inner_form = new \Phalcon\Forms\Form();
     $this->_field_options = (array) $options;
 }