Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
LanguageSelectHeaderElement
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 getInputHTML
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3use MediaWiki\Html\Html;
4use MediaWiki\HTMLForm\Field\HTMLSelectField;
5use MediaWiki\MediaWikiServices;
6
7/**
8 * Acts as a header to the translatable banner message list
9 */
10class LanguageSelectHeaderElement extends HTMLSelectField {
11    public function getInputHTML( $value ) {
12        $html = Html::openElement( 'table', [ 'class' => 'cn-message-table' ] );
13        $html .= Html::openElement( 'tr' );
14
15        $code = MediaWikiServices::getInstance()->getContentLanguage()->getCode();
16        $html .= Html::element( 'td', [ 'class' => 'cn-message-text-origin-header' ],
17            MediaWikiServices::getInstance()->getLanguageNameUtils()->getLanguageName( $code, $code )
18        );
19
20        $html .= Html::rawElement( 'td', [ 'class' => 'cn-message-text-native-header' ],
21            parent::getInputHTML( $value )
22        );
23
24        $html .= Html::closeElement( 'tr' );
25        $html .= Html::closeElement( 'table' );
26
27        return $html;
28    }
29}