/**
  * @desc Constructs a FormFieldCheckbox.
  * @param string $id Field identifier
  * @param string $label Field label
  * @param FormFieldMultipleCheckboxOption[] $selected_options The selected options (can also be an array of string where strings are identifiers of selected options)
  * @param FormFieldMultipleCheckboxOption[] $available_options All the options managed by the field
  * @param string[] $field_options Map containing the options
  * @param FormFieldConstraint[] $constraints The constraints checked during the validation
  */
 public function __construct($id, $label, array $selected_options, array $available_options, array $field_options = array(), array $constraints = array())
 {
     parent::__construct($id, $label, null, $field_options, $constraints);
     $this->set_css_form_field_class('form-field-multiple-checkbox');
     $this->available_options = $available_options;
     $this->set_selected_options($selected_options);
 }
 /**
  * @param Captcha $captcha The captcha to use. If not given, a default captcha will be used.
  */
 public function __construct($id = 'captcha')
 {
     global $LANG;
     $this->captcha = AppContext::get_captcha_service()->get_default_factory();
     $field_options = $this->is_enabled() ? array('required' => true) : array();
     parent::__construct($id, LangLoader::get_message('form.captcha', 'common'), false, $field_options);
 }
 /**
  * @param string $type
  * @return array
  */
 public function prepareConfiguration($type)
 {
     $configuration = parent::prepareConfiguration($type);
     $configuration['size'] = $this->getSize();
     $configuration['maxitems'] = $this->getMaxItems();
     $configuration['minitems'] = $this->getMinItems();
     $configuration['multiple'] = $this->getMultiple();
     $configuration['renderMode'] = $this->getRenderMode();
     $configuration['itemListStyle'] = $this->getItemListStyle();
     $configuration['selectedListStyle'] = $this->getSelectedListStyle();
     return $configuration;
 }
 protected function compute_options(array &$field_options)
 {
     foreach ($field_options as $attribute => $value) {
         $attribute = strtolower($attribute);
         switch ($attribute) {
             case 'max_input':
                 $this->max_input = $value;
                 unset($field_options['max_input']);
                 break;
         }
     }
     parent::compute_options($field_options);
 }
 protected function compute_options(array &$field_options)
 {
     foreach ($field_options as $attribute => $value) {
         $attribute = strtolower($attribute);
         switch ($attribute) {
             case 'max_size':
                 $this->max_size = $value;
                 unset($field_options['max_size']);
                 // TODO add max size constraint
                 break;
         }
     }
     parent::compute_options($field_options);
 }
 protected function compute_options(array &$field_options)
 {
     foreach ($field_options as $attribute => $value) {
         $attribute = strtolower($attribute);
         switch ($attribute) {
             case 'rows':
                 $this->rows = $value;
                 unset($field_options['rows']);
                 break;
             case 'cols':
                 $this->cols = $value;
                 unset($field_options['cols']);
                 break;
         }
     }
     parent::compute_options($field_options);
 }
 /**
  * @desc Constructs a FormFieldUploadFile.
  * @param string $id Field identifier
  * @param string $label Field label
  * @param string $value Default value
  * @param string[] $field_options Map containing the options
  * @param FormFieldConstraint[] $constraints The constraints checked during the validation
  */
 public function __construct($id, $label, $value, $field_options = array(), array $constraints = array())
 {
     $constraints[] = new FormFieldConstraintUrlExists(LangLoader::get_message('form.unexisting_file', 'status-messages-common'));
     parent::__construct($id, $label, $value, $field_options, $constraints);
 }
 /**
  * @desc Constructs a FormFieldCheckbox.
  * @param string $id Field identifier
  * @param string $label Field label
  * @param bool $checked FormFieldCheckbox::CHECKED if it's checked by default or FormFieldCheckbox::UNCHECKED if not checked.
  * @param string[] $field_options Map containing the options
  * @param FormFieldConstraint[] $constraints The constraints checked during the validation
  */
 public function __construct($id, $label, $checked = self::UNCHECKED, array $field_options = array(), array $constraints = array())
 {
     parent::__construct($id, $label, $checked, $field_options, $constraints);
     $this->set_css_form_field_class('form-field-checkbox');
 }
 protected function compute_options(array &$field_options)
 {
     foreach ($field_options as $attribute => $value) {
         $attribute = strtolower($attribute);
         switch ($attribute) {
             case 'max_input':
                 $this->max_input = $value;
                 unset($field_options['max_input']);
                 break;
             case 'size':
                 $this->size = $value;
                 unset($field_options['size']);
                 break;
             case 'method':
                 $this->method = $value;
                 unset($field_options['method']);
                 break;
             case 'file':
                 $this->file = $value;
                 unset($field_options['file']);
                 break;
             case 'name_parameter':
                 $this->name_parameter = $value;
                 unset($field_options['name_parameter']);
                 break;
         }
     }
     parent::compute_options($field_options);
 }
 /**
  * @param string $id
  * @param FormFieldActionLinkElement[] $actions
  */
 public function __construct($id, array $actions)
 {
     $this->actions = $actions;
     parent::__construct($id, '', '');
 }
 /**
  * @param string $id the form field id
  * @param string $title the action title
  * @param Url $url the action url
  * @param Url $img the action icon url
  */
 public function __construct($id, $title, $url, $img)
 {
     $this->action = new FormFieldActionLinkElement($title, $url, $img);
     parent::__construct($id, '', '');
 }
 /**
  * {@inheritdoc}
  */
 public function set_value($value)
 {
     if (is_object($value)) {
         parent::set_value($value);
     } else {
         parent::set_value($this->get_option($value));
     }
 }
 public function __construct($id, AuthorizationsSettings $value, array $field_options = array())
 {
     parent::__construct($id, '', $value, $field_options);
 }
 public function __construct($value, array $properties = array())
 {
     parent::__construct('', '', $value, $properties);
 }
 public function __construct($id, $label, $value, array $field_options = array(), array $constraints = array())
 {
     parent::__construct($id, $label, $value, $field_options, $constraints);
     $this->set_css_form_field_class('form-field-color');
 }
 public function __construct($id, $label, Date $value = null, $field_options = array(), array $constraints = array())
 {
     $constraints[] = new FormFieldConstraintDate();
     parent::__construct($id, $label, $value, $field_options, $constraints);
     $this->set_css_form_field_class('form-field-date');
 }
 public function __construct($id, $label, $value, array $properties = array())
 {
     parent::__construct($id, $label, $value, $properties);
     $this->set_css_form_field_class(empty($label) ? 'form-field-free-large' : 'form-field-free');
 }
 public function __construct($id, $value)
 {
     parent::__construct($id, '', $value, array(), array());
 }
 public function __construct($id, $value)
 {
     parent::__construct($id, '', $value);
 }