collection = $collection; $this->urlBuilder = $urlBuilder; } /** * Check whether all indices are valid or not * * @return bool */ public function isDisplayed() { /** @var \Magento\Indexer\Model\Indexer $indexer */ foreach ($this->collection->getItems() as $indexer) { if ($indexer->getStatus() == \Magento\Framework\Indexer\StateInterface::STATUS_INVALID) { return true; } } return false; } //@codeCoverageIgnoreStart /** * Retrieve unique message identity * * @return string */ public function getIdentity() { return md5('INDEX_INVALID'); } /** * Retrieve message text * * @return \Magento\Framework\Phrase */ public function getText() { $url = $this->urlBuilder->getUrl('indexer/indexer/list'); //@codingStandardsIgnoreStart return __( 'One or more indexers are invalid. Make sure your Magento cron job is running.', $url, 'https://devdocs.magento.com/guides/v2.2/config-guide/cli/config-cli-subcommands-cron.html#create-or-remove-the-magento-crontab' ); //@codingStandardsIgnoreEnd } /** * Retrieve message severity * * @return int */ public function getSeverity() { return self::SEVERITY_MAJOR; } //@codeCoverageIgnoreEnd }