IAlex has uploaded a new change for review. https://gerrit.wikimedia.org/r/144671
Change subject: Add method XmlSelect::addAttributes() and use it in HTMLSelectField ...................................................................... Add method XmlSelect::addAttributes() and use it in HTMLSelectField So that multiple attributes can be set in a single call, which avoids having to do a foreach loop to call setAttribute(). Change-Id: I7b32d79766e06444f87d16d6566f7de8afecfebe --- M includes/Xml.php M includes/htmlform/HTMLSelectField.php 2 files changed, 8 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/71/144671/1 diff --git a/includes/Xml.php b/includes/Xml.php index 6fb5380..96d37a7 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -909,6 +909,13 @@ } /** + * @param array $attrs + */ + public function addAttributes( array $attrs ) { + $this->attributes += $attrs; + } + + /** * @param string $name * @return array|null */ diff --git a/includes/htmlform/HTMLSelectField.php b/includes/htmlform/HTMLSelectField.php index 2bf9f8b..93fc858 100644 --- a/includes/htmlform/HTMLSelectField.php +++ b/includes/htmlform/HTMLSelectField.php @@ -28,10 +28,7 @@ } $allowedParams = array( 'tabindex', 'size' ); - $customParams = $this->getAttributes( $allowedParams ); - foreach( $customParams as $name => $value ) { - $select->setAttribute( $name, $value ); - } + $select->addAttributes( $this->getAttributes( $allowedParams ) ); if ( $this->mClass !== '' ) { $select->setAttribute( 'class', $this->mClass ); -- To view, visit https://gerrit.wikimedia.org/r/144671 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7b32d79766e06444f87d16d6566f7de8afecfebe Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: IAlex <coderev...@emsenhuber.ch> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits