$titleObj->getPrefixedText();
}
- if ( isset( $prop['headitems'] ) || isset( $prop['headhtml'] ) ) {
+ if ( isset( $prop['headitems'] ) ) {
+ $result_array['headitems'] = $this->formatHeadItems( $p_result->getHeadItems() );
+ $this->logFeatureUsage( 'action=parse&prop=headitems' );
+ $this->setWarning( 'headitems is deprecated since MediaWiki 1.28. '
+ . 'Use prop=headhtml when creating new HTML documents, or '
+ . 'prop=modules|jsconfigvars when updating a document client-side.' );
+ }
+
+ if ( isset( $prop['headhtml'] ) ) {
$context = new DerivativeContext( $this->getContext() );
$context->setTitle( $titleObj );
$context->setWikiPage( $pageObj );
$output = new OutputPage( $context );
$output->addParserOutputMetadata( $p_result );
- if ( isset( $prop['headitems'] ) ) {
- $headItems = $this->formatHeadItems( $p_result->getHeadItems() );
-
- $css = $this->formatCss( $output->buildCssLinksArray() );
-
- $scripts = [ $output->getHeadScripts() ];
-
- $result_array['headitems'] = array_merge( $headItems, $css, $scripts );
- }
-
- if ( isset( $prop['headhtml'] ) ) {
- $result_array['headhtml'] = $output->headElement( $context->getSkin() );
- $result_array[ApiResult::META_BC_SUBELEMENTS][] = 'headhtml';
- }
+ $result_array['headhtml'] = $output->headElement( $context->getSkin() );
+ $result_array[ApiResult::META_BC_SUBELEMENTS][] = 'headhtml';
}
if ( isset( $prop['modules'] ) ) {
return $result;
}
- private function formatCss( $css ) {
- $result = [];
- foreach ( $css as $file => $link ) {
- $entry = [];
- $entry['file'] = $file;
- ApiResult::setContentValue( $entry, 'link', $link );
- $result[] = $entry;
- }
-
- return $result;
- }
-
private function formatLimitReportData( $limitReportData ) {
$result = [];
"apihelp-parse-paramvalue-prop-sections": "Gives the sections in the parsed wikitext.",
"apihelp-parse-paramvalue-prop-revid": "Adds the revision ID of the parsed page.",
"apihelp-parse-paramvalue-prop-displaytitle": "Adds the title of the parsed wikitext.",
- "apihelp-parse-paramvalue-prop-headitems": "Gives items to put in the <code><head></code> of the page.",
+ "apihelp-parse-paramvalue-prop-headitems": "<span class=\"apihelp-deprecated\">Deprecated.</span> Gives items to put in the <code><head></code> of the page.",
"apihelp-parse-paramvalue-prop-headhtml": "Gives parsed <code><head></code> of the page.",
- "apihelp-parse-paramvalue-prop-modules": "Gives the ResourceLoader modules used on the page. Either <kbd>jsconfigvars</kbd> or <kbd>encodedjsconfigvars</kbd> must be requested jointly with <kbd>modules</kbd>.",
- "apihelp-parse-paramvalue-prop-jsconfigvars": "Gives the JavaScript configuration variables specific to the page.",
+ "apihelp-parse-paramvalue-prop-modules": "Gives the ResourceLoader modules used on the page. To load, use <code>mw.loader.using()</code>. Either <kbd>jsconfigvars</kbd> or <kbd>encodedjsconfigvars</kbd> must be requested jointly with <kbd>modules</kbd>.",
+ "apihelp-parse-paramvalue-prop-jsconfigvars": "Gives the JavaScript configuration variables specific to the page. To apply, use <code>mw.config.set()</code>.",
"apihelp-parse-paramvalue-prop-encodedjsconfigvars": "Gives the JavaScript configuration variables specific to the page as a JSON string.",
"apihelp-parse-paramvalue-prop-indicators": "Gives the HTML of page status indicators used on the page.",
"apihelp-parse-paramvalue-prop-iwlinks": "Gives interwiki links in the parsed wikitext.",