![]() 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/cartforge.co/app/code/Magefan/Blog/Block/Adminhtml/ |
<?php /** * Copyright © Magefan ([email protected]). All rights reserved. * Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement). */ declare(strict_types=1); namespace Magefan\Blog\Block\Adminhtml; use Magefan\Blog\Model\Config; use Magento\Backend\Block\Widget\Context; class AiButton extends \Magento\Backend\Block\Widget\Grid\Container { const ADMIN_RESOURCE = 'Magefan_Blog::post_save'; /** * @param Config $config * @param Context $context * @param array $data */ public function __construct( Config $config, Context $context, array $data = [] ) { $this->config = $config; parent::__construct($context, $data); } /** * Preparing global layout * * @return $this */ protected function _prepareLayout() { if ($this->config->getConfig('mfblog/ai_writer/enabled_ai_writer') && $this->_authorization->isAllowed(self::ADMIN_RESOURCE) ) { $this->getToolbar()->addChild( 'ai_button', \Magento\Backend\Block\Widget\Button::class, ['label' => __('Add With AI'), 'onclick' => 'window.location.href = \'' . $this->getUrl('blog/createwithai/index') . '\''] ); } return $this; } }