* */ namespace ComboStrap; use dokuwiki\Menu\Item\AbstractItem; /** * Class MenuItem * @package ComboStrap * */ class BacklinkMenuItem extends AbstractItem { const CLASS_HTML = "combo-backlink-item"; const CANONICAL = "backlink"; /** * MetadataMenuItem constructor. */ public function __construct() { $snippetManager = PluginUtility::getSnippetManager(); $snippetManager->attachJavascriptComboLibrary(); $snippetManager->attachJavascriptFromComponentId(self::CANONICAL); parent::__construct(); } /** * * @return string */ public function getLabel(): string { return "Backlinks"; } public function getLinkAttributes($classprefix = 'menuitem '): array { $linkAttributes = parent::getLinkAttributes($classprefix); /** * A class and not an id * because a menu item can be found twice on * a page (For instance if you want to display it in a layout at a * breakpoint and at another in another breakpoint */ $linkAttributes['class'] = self::CLASS_HTML; return $linkAttributes; } public function getTitle(): string { return "Show the backlinks"; } public function getSvg(): string { /** @var string icon file */ return DirectoryLayout::getComboImagesDirectory()->resolve('backlink.svg')->toAbsoluteId(); } }