Routing/ArticleRouteEnhancer.php
private function shouldAddCanonicalTag(array $defaults, Request $request)
    {
        if (!array_key_exists('object', $defaults)) {
            return false;
        }

        $article = $defaults['object'];
        if (!$article instanceof ArticleInterface || !$article instanceof WebspaceBehavior) {
            return false;
        }

        $sulu = $request->get('_sulu');
        if (!$sulu) {
            return false;
        }

        /** @var Webspace $webspace */
        $webspace = $sulu->getAttribute('webspace');
        if (!$webspace) {
            return false;
        }

        $additionalWebspaces = $this->webspaceResolver->resolveAdditionalWebspaces($article);
        if (!$additionalWebspaces || !in_array($webspace->getKey(), $additionalWebspaces)) {
            return false;
        }

        return true;
    }
private function shouldAddCanonicalTag(array $defaults, Request $request)
    {
        if (!array_key_exists('object', $defaults)) {
            return false;
        }

        $article = $defaults['object'];
        if (!$article instanceof ArticleInterface || !$article instanceof WebspaceBehavior) {
            return false;
        }

        $sulu = $request->get('_sulu');
        if (!$sulu) {
            return false;
        }

        /** @var Webspace $webspace */
        $webspace = $sulu->getAttribute('webspace');
        if (!$webspace) {
            return false;
        }

        $additionalWebspaces = $this->webspaceResolver->resolveAdditionalWebspaces($article);
        if (!$additionalWebspaces || !in_array($webspace->getKey(), $additionalWebspaces)) {
            return false;
        }

        return true;
    }
private function shouldAddCanonicalTag ( array $ defaults , Request $ request ) { if ( ! array_key_exists ( 'object' , $ defaults ) ) { return false ; } $ article = $ defaults [ 'object' ] ; if ( ! $ article instanceof ArticleInterface || ! $ article instanceof WebspaceBehavior ) { return false ; } $ sulu = $ request -> get ( '_sulu' ) ; if ( ! $ sulu ) { return false ; } /** @var Webspace $webspace */ $ webspace = $ sulu -> getAttribute ( 'webspace' ) ; if ( ! $ webspace ) { return false ; } $ additionalWebspaces = $ this -> webspaceResolver -> resolveAdditionalWebspaces ( $ article ) ; if ( ! $ additionalWebspaces || ! in_array ( $ webspace -> getKey ( ) , $ additionalWebspaces ) ) { return false ; } return true ; }
Checks if the enhancer should add an canonical tag to the route attributes.

@param array $defaults
@param Request $request

@return bool
Checks if the enhancer should add an canonical tag to the route attributes .