Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
Hooks
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 2
20
0.00% covered (danger)
0.00%
0 / 1
 onBeforePageDisplay
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
12
 onParserFirstCallInit
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace MediaWiki\Extension\CharInsert;
4
5use MediaWiki\Hook\ParserFirstCallInitHook;
6use MediaWiki\Output\Hook\BeforePageDisplayHook;
7
8class Hooks implements
9    BeforePageDisplayHook,
10    ParserFirstCallInitHook
11{
12    /** @inheritDoc */
13    public function onBeforePageDisplay( $out, $skin ): void {
14        if ( $out->getTitle()->isSpecial( 'Upload' ) ||
15            in_array( $out->getActionName(), [ 'edit', 'submit' ] )
16        ) {
17            $out->addModules( 'ext.charinsert' );
18            $out->addModuleStyles( 'ext.charinsert.styles' );
19        }
20    }
21
22    /** @inheritDoc */
23    public function onParserFirstCallInit( $parser ) {
24        $parser->setHook( 'charinsert', [ CharInsert::class, 'charInsertHook' ] );
25    }
26}