/** * Gives able to display titles in menu slider which differ from titles in menu panel * @param \Magento\Backend\Model\Menu\Item $subject * @param string $result * @return string */ public function afterGetTitle($subject, $result) { $ebayKey = 'Ess_M2ePro::ebay'; $amazonKey = 'Ess_M2ePro::amazon'; $isEbayWizardCompleted = $this->wizardHelper->isCompleted(\Ess\M2ePro\Helper\View\Ebay::WIZARD_INSTALLATION_NICK); if ($isEbayWizardCompleted && $subject->getId() == $ebayKey && !isset($this->menuTitlesUsing[$ebayKey])) { $this->menuTitlesUsing[$ebayKey] = true; return 'eBay Integration (Beta)'; } $isAmazonWizardCompleted = $this->wizardHelper->isCompleted(\Ess\M2ePro\Helper\View\Amazon::WIZARD_INSTALLATION_NICK); if ($isAmazonWizardCompleted && $subject->getId() == $amazonKey && !isset($this->menuTitlesUsing[$amazonKey])) { $this->menuTitlesUsing[$amazonKey] = true; return 'Amazon Integration (Beta)'; } return $result; }
/** * Check whether given item is currently selected * * @param \Magento\Backend\Model\Menu\Item $item * @param int $level * @return bool */ protected function _isItemActive(\Magento\Backend\Model\Menu\Item $item, $level) { $itemModel = $this->getActiveItemModel(); $output = false; if ($level == 0 && $itemModel instanceof \Magento\Backend\Model\Menu\Item && ($itemModel->getId() == $item->getId() || $item->getChildren()->get($itemModel->getId()) !== null)) { $output = true; } return $output; }
/** * Check whether provided item is last in list * * @param \Magento\Backend\Model\Menu\Item $item * @return bool */ public function isLast(\Magento\Backend\Model\Menu\Item $item) { return $this->offsetGet(max(array_keys($this->getArrayCopy())))->getId() == $item->getId(); }