/** * Get item for ToC - link with icon and label as contents * @param $title Title for target * @param $text string diplay text for title * @param $image string seed for makeIconOrImage * @param $imageSize int size * @return string html */ protected function renderItem(Title $title, $text, $image, $imageSize) { $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer(); $icon = CollaborationKitIcon::makeIconOrImage($image, $imageSize); $linkContent = new HtmlArmor(Html::rawElement('div', [], $icon . Html::element('span', ['class' => 'mw-ck-toc-item-label'], $text))); return $link = $linkRenderer->makeLink($title, $linkContent); }
/** * Generate an image based on what's in 'image', be it an icon or a file * @param $fallback string for what to do for no icons - nothing, random, specific icon... * @param $size int for non-icon images * @param $seed string fallback seed for explicitly something somethinged ones * @return string */ public function getParsedImage($image, $size = 200) { return CollaborationKitIcon::makeIconOrImage($this->getImage(), $size, 'puzzlepiece'); }