* @author Rhodri Davies * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @link http://www.temando.com/ * * @api * @deprecated since 1.0.5 | Block data is provided by view model * @see \Temando\Shipping\ViewModel\Config\CheckoutFields */ class CheckoutFieldsComponent extends AbstractComponent { /** * @var ModuleConfigInterface */ private $moduleConfig; /** * CheckoutFieldsComponent constructor. * @param WidgetContext $context * @param WsConfigInterface $config * @param StorageInterface $session * @param AuthenticationInterface $auth * @param Token $token * @param DateTime $dateTime * @param RemoteAddress $remoteAddress * @param Config $securityConfig * @param ModuleConfigInterface $moduleConfig * @param mixed[] $data */ public function __construct( WidgetContext $context, WsConfigInterface $config, StorageInterface $session, AuthenticationInterface $auth, Token $token, DateTime $dateTime, RemoteAddress $remoteAddress, Config $securityConfig, ModuleConfigInterface $moduleConfig, array $data = [] ) { $this->moduleConfig = $moduleConfig; parent::__construct( $context, $config, $session, $auth, $token, $dateTime, $remoteAddress, $securityConfig, $data ); } /** * Add Back Button. * * @return \Magento\Backend\Block\Widget\Container */ protected function _prepareLayout() { $buttonData = [ 'label' => __('Back'), 'onclick' => sprintf("window.location.href = '%s';", $this->getConfigurationPageUrl()), 'class' => 'back', 'sort_order' => 10 ]; $this->buttonList->add('back', $buttonData); return parent::_prepareLayout(); } /** * @return string */ public function getUpdateCheckoutFieldEndpoint() { return $this->getUrl('temando/settings_checkout/save'); } /** * @return string */ public function getConfigurationPageUrl() { return $this->getUrl('adminhtml/system_config/edit', [ 'section' => 'carriers', '_fragment' => 'carriers_temando-link', ]); } /** * @return string */ public function getCheckoutFieldsData() { return $this->moduleConfig->getCheckoutFieldsDefinition(); } }