staempfli/magento2-module-seo

View on GitHub
Plugin/RouteConfigPlugin.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace Staempfli\Seo\Plugin;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\Route\Config as Subject;

class RouteConfigPlugin
{
    const MODULE_NAME = 'Staempfli_Seo';

    /**
     * @param Subject $subject
     * @param $result
     * @param $frontName
     * @return array
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
     */
    public function afterGetModulesByFrontName(Subject $subject, $result, $frontName)
    {
        if ($frontName === 'robots' && in_array(self::MODULE_NAME, $result)) {
            return [self::MODULE_NAME];
        }
        return $result;
    }
}