Skip to content

Cms Page Links won't be set when they are loaded over GraphQl #2

@MarianNapi

Description

@MarianNapi

When trying to retrieve a CMS Page over the cmsPage query the links aren't set.

This occurres because in MageWorx\SeoCrossLinks\Model\Observer\AddCrosslinksToPageObserver on line 117 the request FullActionName is compared to a hardcoded 'cms_page_view'. In GraphQl the FullActionName is '__', since the request route, controller and action name are null. So the comparison fails and the observer returns early without applying the links.

if (!in_array($this->request->getFullActionName(), $this->_getAvailableActions())) {
    return true;
}

protected function _getAvailableActions()
{
    return array('cms_page_view');
}

Solution: if the area code by Magento\Framework\App\State::getAreaCode() is 'graphql' do not compare the action names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions