/** * @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); }
/** * @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); }
/** * @desc Constructs a FormFieldChoice. * @param string $id Field id * @param string $label Field label * @param FormFieldEnumOption Default value * @param FormFieldEnumOption[] $options Enumeration of the possible values * @param string[] $field_options Map of the field options (this field has no specific option, there are only the inherited ones) * @param FormFieldConstraint List of the constraints */ public function __construct($id, $label, $value, array $options, array $field_options = array(), array $constraints = array()) { foreach ($options as $option) { $this->add_option($option); } parent::__construct($id, $label, $value, $field_options, $constraints); $this->set_value($value); }
/** * @desc Constructs a FormFieldMultipleSelectChoice. * @param string $id Field id * @param string $label Field label * @param mixed $value Default value (either a FormFieldEnumOption object or a string corresponding to the FormFieldEnumOption's raw value) * @param FormFieldEnumOption[] $options Enumeration of the possible values * @param string[] $field_options Map of the field options (this field has no specific option, there are only the inherited ones) * @param FormFieldConstraint List of the constraints */ public function __construct($id, $label, array $selected_options, array $available_options, array $field_options = array(), array $constraints = array()) { parent::__construct($id, $label, $selected_options, $field_options, $constraints); $this->set_css_form_field_class('form-field-multi-select'); foreach ($available_options as $option) { $this->add_option($option); } $this->set_selected_options($selected_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'); }
public function __construct($id, $label, array $value = array(), array $field_options = array(), array $constraints = array()) { parent::__construct($id, $label, $value, $field_options, $constraints); }
/** * @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, '', ''); }
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); }
/** * @desc Constructs a FormFieldTextEditor. * It has these options in addition to the AbstractFormField ones: * <ul> * <li>size: The size (width) of the HTML field</li> * <li>maxlength: The maximum length for the field</li> * </ul> * @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()) { parent::__construct($id, $label, $value, $field_options, $constraints); $this->set_css_form_field_class('form-field-text'); }
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); }
public function __construct($id, $value) { parent::__construct($id, '', $value, array(), array()); }
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'); }