mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-11-16 04:22:37 +00:00
DAT-3153 missing template hook approach changed
This commit is contained in:
parent
ff1f403dae
commit
b8e82efa10
|
@ -73,7 +73,7 @@ $wgHooks[ 'BeforePageDisplay' ][] = 'PortableInfoboxHooks::onBeforePageDisplay';
|
||||||
$wgHooks[ 'ParserAfterTidy' ][] = 'PortableInfoboxParserTagController::replaceInfoboxMarkers';
|
$wgHooks[ 'ParserAfterTidy' ][] = 'PortableInfoboxParserTagController::replaceInfoboxMarkers';
|
||||||
$wgHooks[ 'ImageServing::buildAndGetIndex' ][] = 'PortableInfoboxHooks::onImageServingCollectImages';
|
$wgHooks[ 'ImageServing::buildAndGetIndex' ][] = 'PortableInfoboxHooks::onImageServingCollectImages';
|
||||||
$wgHooks[ 'wgQueryPages' ][] = 'PortableInfoboxHooks::onWgQueryPages';
|
$wgHooks[ 'wgQueryPages' ][] = 'PortableInfoboxHooks::onWgQueryPages';
|
||||||
$wgHooks[ 'ShowMissingArticle::BeforeTextAppend' ][] = 'PortableInfoboxHooks::onShowMissingArticleBeforeTextAppend';
|
$wgHooks[ 'ArticleNonExistentPage' ][] = 'PortableInfoboxHooks::onArticleNonExistentPage';
|
||||||
$wgHooks[ 'SkinAfterBottomScripts' ][] = 'PortableInfoboxHooks::onSkinAfterBottomScripts';
|
$wgHooks[ 'SkinAfterBottomScripts' ][] = 'PortableInfoboxHooks::onSkinAfterBottomScripts';
|
||||||
|
|
||||||
// special pages
|
// special pages
|
||||||
|
|
|
@ -58,24 +58,19 @@ class PortableInfoboxHooks {
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function onShowMissingArticleBeforeTextAppend( &$article, &$text, &$wgOut, &$errors ) {
|
public static function onArticleNonExistentPage( Article $article, OutputPage $wgOut, $text ) {
|
||||||
$title = $article->getTitle();
|
$title = $article->getTitle();
|
||||||
|
if ( $title && !$title->exists() && $title->inNamespace( NS_TEMPLATE ) ) {
|
||||||
if (
|
|
||||||
$title &&
|
|
||||||
!$title->exists() &&
|
|
||||||
$title->getNamespace() === NS_TEMPLATE &&
|
|
||||||
!count( $errors )
|
|
||||||
) {
|
|
||||||
$text = '';
|
|
||||||
|
|
||||||
$HTML = F::app()->renderView(
|
$HTML = F::app()->renderView(
|
||||||
'PortableInfoboxBuilderSpecialController',
|
'PortableInfoboxBuilderSpecialController',
|
||||||
'renderCreateTemplateEntryPoint',
|
'renderCreateTemplateEntryPoint',
|
||||||
[ 'title' => $title->getText() ]
|
[ 'title' => $title->getText() ]
|
||||||
);
|
);
|
||||||
|
$wgOut->clearHTML();
|
||||||
$wgOut->addHTML( $HTML );
|
$wgOut->addHTML( $HTML );
|
||||||
|
// we don't want to add anything else, it also stops parser
|
||||||
|
// (see Article.php:wfRunHook(ArticleNonExistentPage))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -97,6 +92,7 @@ class PortableInfoboxHooks {
|
||||||
$text .= Html::linkedScript( $script );
|
$text .= Html::linkedScript( $script );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue