|
26 | 26 |
|
27 | 27 | namespace MediaWiki\Extension\BootstrapComponents\Hooks; |
28 | 28 |
|
29 | | -use MediaWiki\Extension\BootstrapComponents\BootstrapComponents; |
30 | 29 | use MediaWiki\Extension\BootstrapComponents\BootstrapComponentsService; |
31 | 30 | /* |
32 | 31 | * TODO switch to these, wehen we drop support for mw < 1.40 |
|
39 | 38 | /** |
40 | 39 | * Class OutputPageParserOutput |
41 | 40 | * |
42 | | - * Called after parse, before the HTML is added to the output. |
43 | | - * |
44 | | - * Method delegated to separate class to fix missing (deferred) content in |
45 | | - * {@see \MediaWiki\Extension\BootstrapComponents\Tests\Integration\BootstrapComponentsJSONScriptTestCaseRunnerTest::assertParserOutputForCase} |
| 41 | + * Called after parse, before the HTML is added to the output. Modal markup is |
| 42 | + * now emitted inline by ModalBuilder::parse() rather than stashed via |
| 43 | + * ParserOutput::setExtensionData and re-injected here, so this hook only |
| 44 | + * handles the Vector-skin module wiring. |
46 | 45 | * |
47 | 46 | * @see https://www.mediawiki.org/wiki/Manual:Hooks/OutputPageParserOutput |
48 | 47 | * |
49 | 48 | * @since 1.2 |
50 | 49 | */ |
51 | 50 | class OutputPageParserOutput { |
52 | 51 |
|
53 | | - /** |
54 | | - * @var string |
55 | | - */ |
56 | | - const INJECTION_PREFIX = '<!-- injected by Extension:BootstrapComponents -->'; |
57 | | - |
58 | | - /** |
59 | | - * @var string |
60 | | - */ |
61 | | - const INJECTION_SUFFIX = '<!-- /injected by Extension:BootstrapComponents -->'; |
62 | | - |
63 | 52 | /** |
64 | 53 | * @var BootstrapComponentsService |
65 | 54 | */ |
@@ -94,36 +83,11 @@ public function __construct( |
94 | 83 | * @return void |
95 | 84 | */ |
96 | 85 | public function process(): void { |
97 | | - $deferredText = $this->getContentForLaterInjection( $this->getParserOutput() ); |
98 | | - if ( !empty( $deferredText ) ) { |
99 | | - $this->getOutputPage()->addHTML( $deferredText ); |
100 | | - } |
101 | | - |
102 | 86 | if ( $this->getBootstrapComponentsService()->vectorSkinInUse() ) { |
103 | 87 | $this->getOutputPage()->addModules( [ 'ext.bootstrapComponents.vector-fix' ] ); |
104 | 88 | } |
105 | 89 | } |
106 | 90 |
|
107 | | - /** |
108 | | - * Returns the raw html that is to be inserted at the end of the page. |
109 | | - * |
110 | | - * @param ParserOutput $parserOutput |
111 | | - * |
112 | | - * @return string |
113 | | - */ |
114 | | - protected function getContentForLaterInjection( ParserOutput $parserOutput ): string { |
115 | | - $deferredContent = $parserOutput |
116 | | - ->getExtensionData(BootstrapComponents::EXTENSION_DATA_DEFERRED_CONTENT_KEY ); |
117 | | - |
118 | | - if ( empty( $deferredContent ) || !is_array( $deferredContent ) ) { |
119 | | - return ''; |
120 | | - } |
121 | | - |
122 | | - // clearing extension data for unit and integration tests to work |
123 | | - $parserOutput->setExtensionData( BootstrapComponents::EXTENSION_DATA_DEFERRED_CONTENT_KEY, null ); |
124 | | - return self::INJECTION_PREFIX . implode( array_values( $deferredContent ) ) . self::INJECTION_SUFFIX; |
125 | | - } |
126 | | - |
127 | 91 | protected function getBootstrapComponentsService(): BootstrapComponentsService { |
128 | 92 | return $this->bootstrapComponentService; |
129 | 93 | } |
|
0 commit comments