本文整理汇总了PHP中OutputPage::setupOOUI方法的典型用法代码示例。如果您正苦于以下问题:PHP OutputPage::setupOOUI方法的具体用法?PHP OutputPage::setupOOUI怎么用?PHP OutputPage::setupOOUI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputPage
的用法示例。
在下文中一共展示了OutputPage::setupOOUI方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: enableOOUI
/**
* Set's up the PHP implementation of OOUI for use in this request
* and instructs OutputPage to enable OOUI for itself.
*
* @since 1.26
*/
public function enableOOUI()
{
OutputPage::setupOOUI();
$this->mOutput->setEnableOOUI(true);
}
示例2: makeHeader
/**
* Helper function for getParsedcontent for making subpage section headers
* @param $contentItem array of data for the content item we're generating the header for
* @return string html (NOTE THIS IS AN OPEN DIV)
*/
protected function makeHeader(Title $title, array $contentItem)
{
global $wgParser;
static $tocLinks = [];
// All used ids for the sections for the toc
$linkRenderer = $wgParser->getLinkRenderer();
$spTitle = Title::newFromText($contentItem['title']);
$spRev = Revision::newFromTitle($spTitle);
// Get display name
if (isset($contentItem['displayTitle'])) {
$spPage = $contentItem['displayTitle'];
} else {
$spPage = $spTitle->getSubpageText();
}
// Generate an id for the section for anchors
// Make sure this matches the ToC anchor generation
$spPageLink = Sanitizer::escapeId(htmlspecialchars($spPage));
$spPageLink2 = $spPageLink;
$spPageLinkCounter = 1;
while (in_array($spPageLink2, $tocLinks)) {
$spPageLink2 = $spPageLink . $spPageLinkCounter;
$spPageLinkCounter++;
}
$tocLinks[] = $spPageLink2;
// Get editsection-style links for the subpage
$sectionLinks = [];
$sectionLinksText = '';
if (isset($spRev)) {
$sectionLinks['viewLink'] = $linkRenderer->makeLink($spTitle, wfMessage('collaborationkit-hub-subpage-view')->inContentLanguage()->text());
}
if ($spTitle->userCan('edit')) {
if (isset($spRev)) {
$linkString = 'edit';
// TODO get appropriate edit link if it's something weird
$sectionLinks['edit'] = $linkRenderer->makeLink($spTitle, wfMessage($linkString)->inContentLanguage()->text(), [], ['action' => 'edit']);
} else {
$linkString = 'create';
$sectionLinks['edit'] = $linkRenderer->makeLink(SpecialPage::getTitleFor('CreateHubFeature'), wfMessage($linkString)->inContentLanguage()->text(), [], ['collaborationhub' => $title->getPrefixedDBKey(), 'feature' => $spTitle->getSubpageText()]);
}
}
if ($title->userCan('edit')) {
$sectionLinks['removeLink'] = $linkRenderer->makeLink($title, wfMessage('collaborationkit-hub-subpage-remove')->inContentLanguage()->text(), [], ['action' => 'edit']);
}
foreach ($sectionLinks as $sectionLink) {
$sectionLinksText .= $this->makeEditSectionLink($sectionLink);
}
$sectionLinksText = Html::rawElement('span', ['class' => 'mw-editsection'], $sectionLinksText);
// Assemble header
// Open general section here since we have the id here
$html = Html::openElement('div', ['class' => 'mw-ck-hub-section', 'id' => $spPageLink2]);
$html .= Html::rawElement('h2', [], Html::element('span', ['class' => 'mw-headline'], $spPage) . $sectionLinksText);
OutputPage::setupOOUI();
return $html;
}