diff options
Diffstat (limited to 'www/wiki/extensions/Translate/utils/JsSelectToInput.php')
-rw-r--r-- | www/wiki/extensions/Translate/utils/JsSelectToInput.php | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/www/wiki/extensions/Translate/utils/JsSelectToInput.php b/www/wiki/extensions/Translate/utils/JsSelectToInput.php index 3016f92b..24f30bc1 100644 --- a/www/wiki/extensions/Translate/utils/JsSelectToInput.php +++ b/www/wiki/extensions/Translate/utils/JsSelectToInput.php @@ -4,7 +4,7 @@ * @file * @author Niklas Laxström * @copyright Copyright © 2010 Niklas Laxström - * @license GPL-2.0+ + * @license GPL-2.0-or-later */ /** @@ -34,14 +34,8 @@ class JsSelectToInput { } /** - * Set the source id of the selector - * @param string $id + * @return string */ - public function setSourceId( $id ) { - $this->sourceId = $id; - } - - /// @return string public function getSourceId() { return $this->sourceId; } @@ -69,7 +63,9 @@ class JsSelectToInput { $this->msg = $message; } - /// @return string Message key. + /** + * @return string Message key. + */ public function getMessage() { return $this->msg; } @@ -80,14 +76,10 @@ class JsSelectToInput { * @return string Html code. */ public function getHtmlAndPrepareJS() { - if ( $this->sourceId === false ) { - if ( is_callable( array( $this->select, 'getAttribute' ) ) ) { - $this->sourceId = $this->select->getAttribute['id']; - } - - if ( !$this->sourceId ) { - throw new MWException( 'ID needs to be specified for the selector' ); - } + $this->sourceId = $this->select->getAttribute( 'id' ); + + if ( !is_string( $this->sourceId ) ) { + throw new MWException( 'ID needs to be specified for the selector' ); } self::injectJs(); @@ -105,16 +97,18 @@ class JsSelectToInput { * @return string */ protected function getButton( $msg, $source, $target ) { - $html = Xml::element( 'input', array( + $html = Xml::element( 'input', [ 'type' => 'button', 'value' => wfMessage( $msg )->text(), - 'onclick' => Xml::encodeJsCall( 'appendFromSelect', array( $source, $target ) ) - ) ); + 'onclick' => Xml::encodeJsCall( 'appendFromSelect', [ $source, $target ] ) + ] ); return $html; } - /// Inject needed JavaScript in the page. + /** + * Inject needed JavaScript in the page. + */ public static function injectJs() { static $done = false; if ( $done ) { |