jenkins-bot has submitted this change and it was merged.
Change subject: Element.php: Add "text" configuration option
......................................................................
Element.php: Add "text" configuration option
This makes the PHP API better match the JS API, even though it's a little
redundant on the PHP side.
Change-Id: I085e6a72a15eb31f58177201f2b088b16ccf27b7
---
M php/Element.php
1 file changed, 8 insertions(+), 2 deletions(-)
Approvals:
Bartosz Dziewoński: Looks good to me, approved
jenkins-bot: Verified
diff --git a/php/Element.php b/php/Element.php
index f327154..e7a509c 100644
--- a/php/Element.php
+++ b/php/Element.php
@@ -51,8 +51,10 @@
* @param array $config Configuration options
* @param string[] $config['classes'] CSS class names to add
* @param string $config['id'] HTML id attribute
- * @param array $config['content'] Content to append, strings or
Element objects. Strings will
- * be HTML-escaped for output, use a HtmlSnippet instance to prevent
that.
+ * @param string $config['text'] Text to insert
+ * @param array $config['content'] Content to append (after text),
strings
+ * or Element objects. Strings will be HTML-escaped for output, use an
+ * HtmlSnippet instance to prevent that.
* @param Mixed $config['data'] Element data
*/
public function __construct( array $config = array() ) {
@@ -69,6 +71,10 @@
if ( isset( $config['id'] ) ) {
$this->setAttributes( array( 'id' => $config['id'] ) );
}
+ if ( isset( $config['text'] ) ) {
+ // JS compatibility
+ $this->appendContent( $config['text'] );
+ }
if ( isset( $config['content'] ) ) {
$this->appendContent( $config['content'] );
}
--
To view, visit https://gerrit.wikimedia.org/r/191244
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I085e6a72a15eb31f58177201f2b088b16ccf27b7
Gerrit-PatchSet: 2
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits