Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 39 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
TalkpageHeaderView | |
0.00% |
0 / 39 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
customizeNavigation | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
6 | |||
show | |
0.00% |
0 / 25 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | use MediaWiki\Xml\Xml; |
4 | |
5 | // Pass-through wrapper with an extra note at the top |
6 | class TalkpageHeaderView extends LqtView { |
7 | public function customizeNavigation( $skin, &$links ) { |
8 | $remove = [ |
9 | 'actions/edit', |
10 | 'actions/addsection', |
11 | 'views/history', |
12 | 'actions/watch', 'actions/move' |
13 | ]; |
14 | |
15 | foreach ( $remove as $rem ) { |
16 | [ $section, $item ] = explode( '/', $rem, 2 ); |
17 | unset( $links[$section][$item] ); |
18 | } |
19 | |
20 | $links['views']['header'] = [ |
21 | 'class' => 'selected', |
22 | 'text' => wfMessage( 'lqt-talkpage-history-tab' )->text(), |
23 | 'href' => '', |
24 | ]; |
25 | } |
26 | |
27 | public function show() { |
28 | if ( $this->request->getVal( 'action' ) === 'edit' ) { |
29 | $html = ''; |
30 | |
31 | $warn_bold = Xml::tags( |
32 | 'strong', |
33 | null, |
34 | wfMessage( 'lqt_header_warning_bold' )->parse() |
35 | ); |
36 | |
37 | $warn_link = $this->talkpageLink( |
38 | $this->title, |
39 | wfMessage( 'lqt_header_warning_new_discussion' )->text(), |
40 | 'talkpage_new_thread' |
41 | ); |
42 | |
43 | $html .= wfMessage( 'lqt_header_warning_before_big' ) |
44 | ->rawParams( $warn_bold, $warn_link )->parse(); |
45 | $html .= Xml::tags( |
46 | 'big', |
47 | null, |
48 | wfMessage( 'lqt_header_warning_big' )->rawParams( $warn_bold, $warn_link )->parse() |
49 | ); |
50 | $html .= wfMessage( 'word-separator' )->escaped(); |
51 | $html .= wfMessage( 'lqt_header_warning_after_big' ) |
52 | ->rawParams( $warn_bold, $warn_link )->parse(); |
53 | |
54 | $html = Xml::tags( 'p', [ 'class' => 'lqt_header_warning' ], $html ); |
55 | |
56 | $this->output->addHTML( $html ); |
57 | } |
58 | |
59 | return true; |
60 | } |
61 | } |