本文整理汇总了PHP中HTMLFormField::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLFormField::__construct方法的具体用法?PHP HTMLFormField::__construct怎么用?PHP HTMLFormField::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLFormField
的用法示例。
在下文中一共展示了HTMLFormField::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param array $params
*/
public function __construct($params)
{
parent::__construct($params);
$this->msg = empty($params['licenses']) ? wfMessage('licenses')->inContentLanguage()->plain() : $params['licenses'];
$this->selected = null;
$this->makeLicenses();
}
示例2: __construct
/**
* @param array $params
* In adition to the usual HTMLFormField parameters, this can take the following fields:
* - flatlist: If given, the options will be displayed on a single line (wrapping to following
* lines if necessary), rather than each one on a line of its own. This is desirable mostly
* for very short lists of concisely labelled options.
*/
public function __construct($params)
{
parent::__construct($params);
if (isset($params['flatlist'])) {
$this->mClass .= ' mw-htmlform-flatlist';
}
}
示例3: __construct
/**
* Constructor
*
* @param $params array
*/
public function __construct($params)
{
parent::__construct($params);
$this->msg = empty($params['licenses']) ? wfMsg('licenses') : $params['licenses'];
$this->selected = null;
$this->makeLicenses();
}
示例4: __construct
public function __construct($params)
{
parent::__construct($params);
# Per HTML5 spec, hidden fields cannot be 'required'
# http://www.w3.org/TR/html5/forms.html#hidden-state-%28type=hidden%29
unset($this->mParams['required']);
}
示例5: __construct
public function __construct($params)
{
parent::__construct($params);
# Per HTML5 spec, hidden fields cannot be 'required'
# http://dev.w3.org/html5/spec/states-of-the-type-attribute.html#hidden-state
unset($this->mParams['required']);
}
示例6: __construct
public function __construct($info)
{
$info['nodata'] = true;
if (isset($info['flags'])) {
$this->mFlags = $info['flags'];
}
# Generate the label from a message, if possible
if (isset($info['buttonlabel-message'])) {
$msgInfo = $info['buttonlabel-message'];
if (is_array($msgInfo)) {
$msg = array_shift($msgInfo);
} else {
$msg = $msgInfo;
$msgInfo = array();
}
$this->buttonLabel = $this->msg($msg, $msgInfo)->parse();
} elseif (isset($info['buttonlabel'])) {
if ($info['buttonlabel'] === ' ') {
// Apparently some things set   directly and in an odd format
$this->buttonLabel = ' ';
} else {
$this->buttonLabel = htmlspecialchars($info['buttonlabel']);
}
} elseif (isset($info['buttonlabel-raw'])) {
$this->buttonLabel = $info['buttonlabel-raw'];
}
parent::__construct($info);
}
示例7: __construct
public function __construct($params)
{
$missing = array_diff(self::$requiredParams, array_keys($params));
if ($missing) {
throw new HTMLFormFieldRequiredOptionsException($this, $missing);
}
parent::__construct($params);
}
示例8: __construct
public function __construct($info)
{
$info['nodata'] = true;
if (isset($info['flags'])) {
$this->mFlags = $info['flags'];
}
parent::__construct($info);
}
示例9: __construct
public function __construct($params)
{
parent::__construct($params);
// For differentiating the type of form, mainly
if (isset($params['prefix'])) {
$this->prefix = $params['prefix'];
}
}
示例10: __construct
/**
* @param array $params
* - type: HTML textfield type
* - size: field size in characters (defaults to 45)
* - placeholder/placeholder-message: set HTML placeholder attribute
* - spellcheck: set HTML spellcheck attribute
* - persistent: upon unsuccessful requests, retain the value (defaults to true, except
* for password fields)
*/
public function __construct($params)
{
parent::__construct($params);
if (isset($params['placeholder-message'])) {
$this->mPlaceholder = $this->getMessage($params['placeholder-message'])->parse();
} elseif (isset($params['placeholder'])) {
$this->mPlaceholder = $params['placeholder'];
}
}
示例11: __construct
public function __construct($params)
{
parent::__construct($params);
if (isset($this->mParams['output-as-default'])) {
$this->outputAsDefault = (bool) $this->mParams['output-as-default'];
}
# Per HTML5 spec, hidden fields cannot be 'required'
# http://www.w3.org/TR/html5/forms.html#hidden-state-%28type=hidden%29
unset($this->mParams['required']);
}
示例12: __construct
/**
* @param array $params
* In adition to the usual HTMLFormField parameters, this can take the following fields:
* - dropdown: If given, the options will be displayed inside a dropdown with a text field that
* can be used to filter them. This is desirable mostly for very long lists of options.
* This only works for users with JavaScript support and falls back to the list of checkboxes.
* - flatlist: If given, the options will be displayed on a single line (wrapping to following
* lines if necessary), rather than each one on a line of its own. This is desirable mostly
* for very short lists of concisely labelled options.
*/
public function __construct($params)
{
parent::__construct($params);
// For backwards compatibility, also handle the old way with 'cssclass' => 'mw-chosen'
if (isset($params['dropdown']) || strpos($this->mClass, 'mw-chosen') !== false) {
$this->mClass .= ' mw-htmlform-dropdown';
}
if (isset($params['flatlist'])) {
$this->mClass .= ' mw-htmlform-flatlist';
}
}
示例13: __construct
public function __construct($info)
{
if (isset($info['buttonclass'])) {
$this->mButtonClass = $info['buttonclass'];
}
if (isset($info['buttonid'])) {
$this->mButtonId = $info['buttonid'];
}
if (isset($info['buttonname'])) {
$this->mButtonName = $info['buttonname'];
}
if (isset($info['buttondefault'])) {
$this->mButtonValue = $info['buttondefault'];
}
if (isset($info['buttontype'])) {
$this->mButtonType = $info['buttontype'];
}
parent::__construct($info);
}
示例14: __construct
public function __construct($params)
{
$this->uniqueId = get_class($this) . ++self::$counter . 'x';
parent::__construct($params);
if (empty($this->mParams['fields']) || !is_array($this->mParams['fields'])) {
throw new MWException('HTMLFormFieldCloner called without any fields');
}
// Make sure the delete button, if explicitly specified, is sane
if (isset($this->mParams['fields']['delete'])) {
$class = 'mw-htmlform-cloner-delete-button';
$info = $this->mParams['fields']['delete'] + ['cssclass' => $class];
unset($info['name'], $info['class']);
if (!isset($info['type']) || $info['type'] !== 'submit') {
throw new MWException('HTMLFormFieldCloner delete field, if specified, must be of type "submit"');
}
if (!in_array($class, explode(' ', $info['cssclass']))) {
$info['cssclass'] .= " {$class}";
}
$this->mParams['fields']['delete'] = $info;
}
}
示例15: __construct
public function __construct($info)
{
$info['nodata'] = true;
if (isset($info['flags'])) {
$this->mFlags = $info['flags'];
}
# Generate the label from a message, if possible
if (isset($info['buttonlabel-message'])) {
$this->buttonLabel = $this->getMessage($info['buttonlabel-message'])->parse();
} elseif (isset($info['buttonlabel'])) {
if ($info['buttonlabel'] === ' ') {
// Apparently some things set   directly and in an odd format
$this->buttonLabel = ' ';
} else {
$this->buttonLabel = htmlspecialchars($info['buttonlabel']);
}
} elseif (isset($info['buttonlabel-raw'])) {
$this->buttonLabel = $info['buttonlabel-raw'];
}
$this->setShowEmptyLabel(false);
parent::__construct($info);
}