![]() 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/app/code/Cnc/AdminHistory/Block/Adminhtml/Customer/Edit/Tab/ |
<?php /** * Copyright (c) 2020 Kaliop Digital Commerce (https://digitalcommerce.kaliop.com) All Rights Reserved. * https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * Cnc * Radosław Stępień <[email protected]> <[email protected]> */ namespace Cnc\AdminHistory\Block\Adminhtml\Customer\Edit\Tab; use Cnc\AdminHistory\Block\Adminhtml\Customer\Edit\Grid; use Cnc\AdminHistory\Model\ResourceModel\Customer\CollectionFactory; use Magento\Backend\Block\Template\Context; use Magento\Backend\Block\Widget\Grid as MagentoWidgetGrid; use Magento\Backend\Helper\Data; use Magento\Customer\Controller\RegistryConstants; use Magento\Framework\Registry; use Magento\Ui\Component\Layout\Tabs\TabInterface; /** * Adminhtml customer billing agreement tab * * @api * @SuppressWarnings(PHPMD.DepthOfInheritance) * @since 100.0.2 */ class History extends Grid implements TabInterface { /** * @var Registry|null */ protected $_coreRegistry = null; public function __construct( Context $context, Data $backendHelper, CollectionFactory $historyCollectionFactory, Registry $coreRegistry, array $data = [] ) { parent::__construct($context, $backendHelper, $historyCollectionFactory, $data); $this->_coreRegistry = $coreRegistry; } /** * {@inheritdoc} */ public function getTabLabel() { return __('CNC_AdminHistory_Title'); } /** * {@inheritdoc} */ public function getTabTitle() { return __('CNC_AdminHistory_Title'); } /** * {@inheritdoc} */ public function canShowTab() { return $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID) !== null; } /** * Prepare collection for grid * * @return $this */ protected function _prepareCollection() { $customerId = $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID); $collection = $this->historyCollectionFactory->create()->addFieldToFilter( 'customer_id', $customerId )->setOrder( 'updated_at' ); $this->setCollection($collection); return MagentoWidgetGrid::_prepareCollection(); } /** * @Override - nothing changed here, override because of implemented class * Tab class getter * * @return string */ public function getTabClass() { return ''; } /** * @Override - nothing changed here, override because of implemented class * Return URL link to Tab content * * @return string */ public function getTabUrl() { return ''; } /** * @Override - nothing changed here, override because of implemented class * Tab should be loaded trough Ajax call * * @return bool */ public function isAjaxLoaded() { return false; } /** * @Override - nothing changed here, override because of implemented class * Tab is hidden * * @return boolean */ public function isHidden() { return false; } }