本文整理汇总了PHP中HTMLForm::getRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLForm::getRequest方法的具体用法?PHP HTMLForm::getRequest怎么用?PHP HTMLForm::getRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLForm
的用法示例。
在下文中一共展示了HTMLForm::getRequest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getErrorsAndErrorClass
/**
* Determine form errors to display and their classes
* @since 1.20
*
* @param string $value The value of the input
* @return array
*/
public function getErrorsAndErrorClass($value)
{
$errors = $this->validate($value, $this->mParent->mFieldData);
if ($errors === true || !$this->mParent->getRequest()->wasPosted() && $this->mParent->getMethod() === 'post') {
$errors = '';
$errorClass = '';
} else {
$errors = self::formatErrors($errors);
$errorClass = 'mw-htmlform-invalid-input';
}
return array($errors, $errorClass);
}
示例2: getTableRow
/**
* Get the complete table row for the input, including help text,
* labels, and whatever.
* @param $value String the value to set the input to.
* @return String complete HTML table row.
*/
function getTableRow($value)
{
# Check for invalid data.
$errors = $this->validate($value, $this->mParent->mFieldData);
$cellAttributes = array();
$verticalLabel = false;
if (!empty($this->mParams['vertical-label'])) {
$cellAttributes['colspan'] = 2;
$verticalLabel = true;
}
if ($errors === true || !$this->mParent->getRequest()->wasPosted() && $this->mParent->getMethod() == 'post') {
$errors = '';
$errorClass = '';
} else {
$errors = self::formatErrors($errors);
$errorClass = 'mw-htmlform-invalid-input';
}
$label = $this->getLabelHtml($cellAttributes);
$field = Html::rawElement('td', array('class' => 'mw-input') + $cellAttributes, $this->getInputHTML($value) . "\n{$errors}");
$fieldType = get_class($this);
if ($verticalLabel) {
$html = Html::rawElement('tr', array('class' => 'mw-htmlform-vertical-label'), $label);
$html .= Html::rawElement('tr', array('class' => "mw-htmlform-field-{$fieldType} {$this->mClass} {$errorClass}"), $field);
} else {
$html = Html::rawElement('tr', array('class' => "mw-htmlform-field-{$fieldType} {$this->mClass} {$errorClass}"), $label . $field);
}
$helptext = null;
if (isset($this->mParams['help-message'])) {
$msg = wfMessage($this->mParams['help-message']);
if ($msg->exists()) {
$helptext = $msg->parse();
}
} elseif (isset($this->mParams['help-messages'])) {
# help-message can be passed a message key (string) or an array containing
# a message key and additional parameters. This makes it impossible to pass
# an array of message key
foreach ($this->mParams['help-messages'] as $name) {
$msg = wfMessage($name);
if ($msg->exists()) {
if (is_null($helptext)) {
$helptext = '';
} else {
$helptext .= wfMessage('word-separator')->escaped();
// some space
}
$helptext .= $msg->parse();
// append message
}
}
} elseif (isset($this->mParams['help'])) {
$helptext = $this->mParams['help'];
}
if (!is_null($helptext)) {
$row = Html::rawElement('td', array('colspan' => 2, 'class' => 'htmlform-tip'), $helptext);
$row = Html::rawElement('tr', array(), $row);
$html .= "{$row}\n";
}
return $html;
}
示例3: getTableRow
/**
* Get the complete table row for the input, including help text,
* labels, and whatever.
* @param $value String the value to set the input to.
* @return String complete HTML table row.
*/
function getTableRow($value)
{
# Check for invalid data.
$errors = $this->validate($value, $this->mParent->mFieldData);
$cellAttributes = array();
$verticalLabel = false;
if (!empty($this->mParams['vertical-label'])) {
$cellAttributes['colspan'] = 2;
$verticalLabel = true;
}
if ($errors === true || $this->mParent->blockSubmit || !$this->mParent->getRequest()->wasPosted() && $this->mParent->getMethod() == 'post') {
$errors = '';
$errorClass = '';
} else {
$errors = self::formatErrors($errors);
$errorClass = 'mw-htmlform-invalid-input';
}
$helptext = null;
if (isset($this->mParams['help-message'])) {
// If msg has parameters (to be parsed by i18n logic, help-message is an array.
if (is_array($this->mParams['help-message'])) {
// Then first element is i18n id, the rest are parameters.
$msg = wfMessage(array_shift($this->mParams['help-message']), $this->mParams['help-message']);
} else {
$msg = wfMessage($this->mParams['help-message']);
}
if ($msg->exists()) {
$helptext = $msg->parse();
}
} elseif (isset($this->mParams['help-messages'])) {
# help-message can be passed a message key (string) or an array containing
# a message key and additional parameters. This makes it impossible to pass
# an array of message key
foreach ($this->mParams['help-messages'] as $name) {
if (is_array($name)) {
$msg = wfMessage(array_shift($name), $name);
} else {
$msg = wfMessage($name);
}
if ($msg->exists()) {
$helptext .= $msg->parse();
// append message
}
}
} elseif (isset($this->mParams['help'])) {
$helptext = $this->mParams['help'];
}
if (!is_null($helptext)) {
$helptext = Html::rawElement('span', array('class' => 'sread help htmlform-tip'), $helptext);
}
$label = $this->getLabelHtml($cellAttributes);
$field = $this->getInputHTML($value) . "\n{$errors}";
$fieldType = get_class($this);
if ($verticalLabel) {
$html = Html::rawElement('p', array('class' => 'mw-htmlform-vertical-label'), $label);
$html .= Html::rawElement('p', array('class' => "mw-htmlform-field-{$fieldType} {$this->mClass} {$errorClass}"), $field . $helptext);
} else {
$html = Html::rawElement('p', array('class' => "mw-htmlform-field-{$fieldType} {$this->mClass} {$errorClass}"), $label . $field . $helptext);
}
return $html;
}