| Current Path : /home/rtorresani/www/vendor/mageplaza/magento-2-blog-extension/Block/Adminhtml/Topic/ |
| Current File : //home/rtorresani/www/vendor/mageplaza/magento-2-blog-extension/Block/Adminhtml/Topic/Edit.php |
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Blog\Block\Adminhtml\Topic;
use Magento\Backend\Block\Widget\Context;
use Magento\Backend\Block\Widget\Form\Container;
use Magento\Framework\Registry;
use Mageplaza\Blog\Model\Topic;
/**
* Class Edit
* @package Mageplaza\Blog\Block\Adminhtml\Topic
*/
class Edit extends Container
{
/**
* Core registry
*
* @var Registry
*/
public $coreRegistry;
/**
* Edit constructor.
*
* @param Context $context
* @param Registry $coreRegistry
* @param array $data
*/
public function __construct(
Context $context,
Registry $coreRegistry,
array $data = []
) {
$this->coreRegistry = $coreRegistry;
parent::__construct($context, $data);
}
/**
* Initialize Topic edit block
*
* @return void
*/
protected function _construct()
{
$this->_blockGroup = 'Mageplaza_Blog';
$this->_controller = 'adminhtml_topic';
parent::_construct();
$this->buttonList->add(
'save-and-continue',
[
'label' => __('Save and Continue Edit'),
'class' => 'save',
'data_attribute' => [
'mage-init' => [
'button' => [
'event' => 'saveAndContinueEdit',
'target' => '#edit_form'
]
]
]
],
-100
);
}
/**
* Retrieve text for header element depending on loaded Topic
*
* @return string
*/
public function getHeaderText()
{
/** @var Topic $topic */
$topic = $this->coreRegistry->registry('mageplaza_blog_topic');
if ($topic->getId()) {
return __("Edit Topic '%1'", $this->escapeHtml($topic->getName()));
}
return __('New Topic');
}
}