Exemplo n.º 1
0
 /**
  * @param Form $form
  * @param string $name
  * @param array $attributes
  */
 public function __construct(Form $form, $name, $attributes = array())
 {
     $this->form = $form;
     if (!is_int($name) && !isset($attributes['name'])) {
         $attributes['name'] = $name;
     }
     if (isset($attributes['label'])) {
         $this->label = $attributes['label'];
         unset($attributes['label']);
     }
     if (isset($attributes['options'])) {
         $this->options = $attributes['options'];
         unset($attributes['options']);
     }
     if (isset($attributes['help'])) {
         $this->help = $attributes['help'];
         unset($attributes['help']);
     }
     if (isset($attributes['tooltip'])) {
         $this->tooltip = $attributes['tooltip'];
         unset($attributes['tooltip']);
     }
     if (array_key_exists('security', $attributes)) {
         $this->security = !empty($attributes['security']);
         unset($attributes['security']);
     }
     $this->default = isset($attributes['default']) ? $attributes['default'] : null;
     unset($attributes['default']);
     parent::__construct($attributes);
     if (!isset($this->default) && isset($this->value)) {
         $this->default = isset($default) ? $default : $this->value;
     }
 }