public function __construct($name = null, $attributes = null, array $data = array()) { parent::__construct($name, $attributes, $data); // "checked" attribute should be updated on changes to "value" attribute // see bug #15708 $this->watchedAttributes[] = 'value'; }
public function __construct($name = null, $attributes = null, array $data = array()) { parent::__construct($name, $attributes, $data); $this->attributes['type'] = 'concrete'; }
/** * Class constructor * * Possible keys in $data array are: * - 'messageProvider': an instance of a class implementing * HTML_QuickForm2_MessageProvider interface, this will be used to get * localized error messages. Default will be used if not given. * - 'language': language to display error messages in, will be passed to * message provider. * - 'errorMessages': (DEPRECATED, use messageProvider) an array of error * messages with the following format * <pre> * 'language code 1' => array( * UPLOAD_ERR_... => 'message', * ... * UPLOAD_ERR_... => 'message' * ), * ... * 'language code N' => array( * ... * ) * </pre> * Note that error messages for UPLOAD_ERR_INI_SIZE and UPLOAD_ERR_FORM_SIZE * may contain '%d' placeholders that will be automatically replaced by the * appropriate size limits. Note also that you don't need to provide messages * for every possible error code in the arrays, you may e.g. override just * one error message for a particular language. * * @param string Element name * @param mixed Attributes (either a string or an array) * @param array Data used to set up error messages for PHP's file * upload errors. */ public function __construct($name = null, $attributes = null, array $data = array()) { // Using deprecated 'errorMessages' key, let's keep this separate to remove later if (isset($data['errorMessages'])) { HTML_QuickForm2_Loader::loadClass('HTML_QuickForm2_MessageProvider_Default'); $this->messageProvider = HTML_QuickForm2_MessageProvider_Default::getInstance(); // neither array_merge() nor array_merge_recursive will do foreach ($data['errorMessages'] as $lang => $ary) { foreach ($ary as $code => $message) { $this->messageProvider->set(array('file', $code), $lang, $message); } } } elseif (isset($data['messageProvider'])) { if (!is_callable($data['messageProvider']) && !$data['messageProvider'] instanceof HTML_QuickForm2_MessageProvider) { throw new HTML_QuickForm2_InvalidArgumentException("messageProvider: expecting a callback or an implementation" . " of HTML_QuickForm2_MessageProvider"); } $this->messageProvider = $data['messageProvider']; } else { HTML_QuickForm2_Loader::loadClass('HTML_QuickForm2_MessageProvider_Default'); $this->messageProvider = HTML_QuickForm2_MessageProvider_Default::getInstance(); } if (isset($data['language'])) { $this->language = $data['language']; } unset($data['messageProvider'], $data['errorMessages'], $data['language']); parent::__construct($name, $attributes, $data); }
/** * Class constructor * * Possible keys in $data array are: * - 'language': language to display error messages in, it should either be * already available in the class or provided in 'errorMessages' * - 'errorMessages': an array of error messages with the following format * <pre> * 'language code 1' => array( * UPLOAD_ERR_... => 'message', * ... * UPLOAD_ERR_... => 'message' * ), * ... * 'language code N' => array( * ... * ) * </pre> * Note that error messages for UPLOAD_ERR_INI_SIZE and UPLOAD_ERR_FORM_SIZE * may contain '%d' placeholders that will be automatically replaced by the * appropriate size limits. Note also that you don't need to provide messages * for every possible error code in the arrays, you may e.g. override just * one error message for a particular language. * * @param string Element name * @param mixed Attributes (either a string or an array) * @param array Data used to set up error messages for PHP's file * upload errors. */ public function __construct($name = null, $attributes = null, array $data = array()) { if (isset($data['errorMessages'])) { // neither array_merge() nor array_merge_recursive will do foreach ($data['errorMessages'] as $lang => $ary) { foreach ($ary as $code => $message) { $this->errorMessages[$lang][$code] = $message; } } unset($data['errorMessages']); } if (!isset($data['language'])) { $this->language = self::DEFAULT_LANGUAGE; } else { $this->language = isset($this->errorMessages[$data['language']]) ? $data['language'] : self::DEFAULT_LANGUAGE; unset($data['language']); } parent::__construct($name, $attributes, $data); }
public function __construct($name = null, $attributes = null, $data = null) { if (is_array($attributes) && isset($attributes['class'])) { $attributes['class'] = $attributes['class'] . ' options-editor'; } else { $attributes['class'] = 'options-editor'; } parent::__construct($name, $attributes, $data); }
/** * Class constructor * * Possible keys in $data array are: * - 'messageProvider': an instance of a class implementing * HTML_QuickForm2_MessageProvider interface, this will be used to get * localized error messages. Default will be used if not given. * - 'language': language to display error messages in, will be passed to * message provider. * * @param string $name Element name * @param string|array $attributes Attributes (either a string or an array) * @param array $data Data used to set up error messages for PHP's * file upload errors. */ public function __construct($name = null, $attributes = null, array $data = array()) { if (isset($data['messageProvider'])) { if (!is_callable($data['messageProvider']) && !$data['messageProvider'] instanceof HTML_QuickForm2_MessageProvider) { throw new HTML_QuickForm2_InvalidArgumentException("messageProvider: expecting a callback or an implementation" . " of HTML_QuickForm2_MessageProvider"); } $this->messageProvider = $data['messageProvider']; } else { HTML_QuickForm2_Loader::loadClass('HTML_QuickForm2_MessageProvider_Default'); $this->messageProvider = HTML_QuickForm2_MessageProvider_Default::getInstance(); } if (isset($data['language'])) { $this->language = $data['language']; } unset($data['messageProvider'], $data['language']); parent::__construct($name, $attributes, $data); }
function __construct($name = null, $attributes = null, $data = null) { $this->attributes['type'] = 'period'; $this->options = array('d' => ___('Days'), 'm' => ___('Months'), 'y' => ___('Years'), 'lifetime' => ___('Lifetime')); parent::__construct($name, $attributes, $data); $this->period = new Am_Period(); }
/** * Create new instance. * * Captcha-specific data attributes: * - captchaSolved - Text to show when the Captcha has been * solved * - captchaSolutionWrong - Error message to show when the captcha * solution entered by the user is wrong * - captchaRender - Boolean to determine if the captcha itself * is to be rendered with the solution * input element * * @param string $name Element name * @param mixed $attributes Attributes (either a string or an array) * @param array $data Element data (special captcha settings) */ public function __construct($name = null, $attributes = null, $data = array()) { //we fill the class data array before it gets merged with $data $this->data['captchaSolutionWrong'] = 'Captcha solution is wrong'; $this->data['captchaSolved'] = 'Captcha already solved'; $this->data['captchaRender'] = true; if (!isset($this->data['captchaHtmlAttributes']['class'])) { $this->data['captchaHtmlAttributes']['class'] = ''; } $this->data['captchaHtmlAttributes']['class'] .= ' qf2-captcha-question'; parent::__construct($name, $attributes, $data); }