init
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\Catalog\Block\Adminhtml\MixStepPricing;
|
||||
|
||||
use Esun\Catalog\Model\MixStepPricing\ValidationState;
|
||||
use Magento\Backend\Block\Template;
|
||||
use Magento\Backend\Block\Template\Context;
|
||||
|
||||
class Form extends Template
|
||||
{
|
||||
protected $_template = 'Esun_Catalog::mix_step_pricing/form.phtml';
|
||||
|
||||
public function __construct(
|
||||
Context $context,
|
||||
private readonly ValidationState $validationState,
|
||||
array $data = []
|
||||
) {
|
||||
parent::__construct($context, $data);
|
||||
}
|
||||
|
||||
public function isDelete(): bool
|
||||
{
|
||||
return $this->getMode() === 'delete';
|
||||
}
|
||||
|
||||
public function getMode(): string
|
||||
{
|
||||
return (string)$this->getData('mode');
|
||||
}
|
||||
|
||||
public function getValidationState(): array
|
||||
{
|
||||
return $this->validationState->get($this->getMode());
|
||||
}
|
||||
|
||||
public function getValidateUrl(): string
|
||||
{
|
||||
return $this->getUrl('esun_catalog/mixsteppricing/' . ($this->isDelete() ? 'validateDelete' : 'validateImport'));
|
||||
}
|
||||
|
||||
public function getRunUrl(): string
|
||||
{
|
||||
return $this->getUrl('esun_catalog/mixsteppricing/' . ($this->isDelete() ? 'runDelete' : 'runImport'));
|
||||
}
|
||||
|
||||
public function getTemplateUrl(): string
|
||||
{
|
||||
return $this->getUrl(
|
||||
'esun_catalog/mixsteppricing/' . ($this->isDelete() ? 'downloadDeleteTemplate' : 'downloadImportTemplate')
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user