![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/mageworx/module-seobase/Model/Robots/ |
<?php /** * Copyright © 2015 MageWorx. All rights reserved. * See LICENSE.txt for license details. */ namespace MageWorx\SeoBase\Model\Robots; use MageWorx\SeoBase\Helper\Data as HelperData; use Magento\Framework\Registry; use Magento\Framework\App\RequestInterface; use Magento\Framework\UrlInterface; use Magento\Framework\View\Layout; /** * SEO Base CMS page robots model */ class Page extends \MageWorx\SeoBase\Model\Robots { /** * @var \Magento\Framework\Registry */ protected $registry; /** * @var \Magento\Framework\View\Layout */ protected $layout; /** * * @param HelperData $helperData * @param Registry $registry * @param RequestInterface $request * @param UrlInterface $url * @param Layout $layout */ public function __construct( HelperData $helperData, Registry $registry, RequestInterface $request, UrlInterface $url, Layout $layout, $fullActionName ) { $this->layout = $layout; $this->registry = $registry; parent::__construct($helperData, $request, $url, $fullActionName); } /** * Retrieve final robots * * @return string */ public function getRobots() { $metaRobots = $this->getPageRobots(); return $metaRobots ? $metaRobots : $this->getRobotsBySettings(); } /** * Retrieve robots from CMS page data * * @return string|null */ protected function getPageRobots() { $block = $this->layout->getBlock('cms_page'); if (is_object($block)) { $page = $block->getPage(); if (is_object($page) && $page->getMetaRobots()) { return $page->getMetaRobots(); } } return null; } }