dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Avoid GlobalTitleFail in HTMLFormField::__construct
[lhc/web/wiklou.git]
/
includes
/
htmlform
/
HTMLForm.php
diff --git
a/includes/htmlform/HTMLForm.php
b/includes/htmlform/HTMLForm.php
index
62345b8
..
df805aa
100644
(file)
--- a/
includes/htmlform/HTMLForm.php
+++ b/
includes/htmlform/HTMLForm.php
@@
-246,10
+246,7
@@
class HTMLForm extends ContextSource {
$this->mUseMultipart = true;
}
$this->mUseMultipart = true;
}
- $field = self::loadInputFromParameters( $fieldname, $info );
- // FIXME During field's construct, the parent form isn't available!
- // could add a 'parent' name-value to $info, could add a third parameter.
- $field->mParent = $this;
+ $field = self::loadInputFromParameters( $fieldname, $info, $this );
// vform gets too much space if empty labels generate HTML.
if ( $this->isVForm() ) {
// vform gets too much space if empty labels generate HTML.
if ( $this->isVForm() ) {
@@
-359,14
+356,18
@@
class HTMLForm extends ContextSource {
*
* @param string $fieldname Name of the field
* @param array $descriptor Input Descriptor, as described above
*
* @param string $fieldname Name of the field
* @param array $descriptor Input Descriptor, as described above
+ * @param HTMLForm|null $parent Parent instance of HTMLForm
*
* @throws MWException
* @return HTMLFormField Instance of a subclass of HTMLFormField
*/
*
* @throws MWException
* @return HTMLFormField Instance of a subclass of HTMLFormField
*/
- public static function loadInputFromParameters( $fieldname, $descriptor ) {
+ public static function loadInputFromParameters( $fieldname, $descriptor
, HTMLForm $parent = null
) {
$class = self::getClassFromDescriptor( $fieldname, $descriptor );
$descriptor['fieldname'] = $fieldname;
$class = self::getClassFromDescriptor( $fieldname, $descriptor );
$descriptor['fieldname'] = $fieldname;
+ if ( $parent ) {
+ $descriptor['parent'] = $parent;
+ }
# @todo This will throw a fatal error whenever someone try to use
# 'class' to feed a CSS class instead of 'cssclass'. Would be
# @todo This will throw a fatal error whenever someone try to use
# 'class' to feed a CSS class instead of 'cssclass'. Would be