jenkins-bot has submitted this change and it was merged.
Change subject: Add new HTMLForm::addHiddenFields() methods
......................................................................
Add new HTMLForm::addHiddenFields() methods
Allows to set various hidden fields from a single method call;
can be used with:
$form->addHiddenFields( $context->getRequest()->getValues( /* field list */ ) );
Change-Id: I864584e5889297bb680808163f48795bab8f7afb
---
M includes/HTMLForm.php
1 file changed, 15 insertions(+), 0 deletions(-)
Approvals:
Parent5446: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php
index 84e7874..ed9440c 100644
--- a/includes/HTMLForm.php
+++ b/includes/HTMLForm.php
@@ -575,6 +575,21 @@
}
/**
+ * Add an array of hidden fields to the output
+ *
+ * @since 1.22
+ * @param array $fields Associative array of fields to add;
+ * mapping names to their values
+ * @return HTMLForm $this for chaining calls
+ */
+ public function addHiddenFields( array $fields ) {
+ foreach ( $fields as $name => $value ) {
+ $this->mHiddenFields[] = array( $value, array( 'name'
=> $name ) );
+ }
+ return $this;
+ }
+
+ /**
* Add a button to the form
* @param string $name field name.
* @param string $value field value
--
To view, visit https://gerrit.wikimedia.org/r/79562
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I864584e5889297bb680808163f48795bab8f7afb
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: IAlex <[email protected]>
Gerrit-Reviewer: IAlex <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits