0

I want to disable the button Vender/Module/Block/Adminhtml/Module/Edit/RejectButton


namespace Vender\Module\Block\Adminhtml\MakeAnOffer\Edit;

use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;


class RejectButton  implements ButtonProviderInterface
{
    protected $request;

    /**
     * Url Builder
     *
     * @var \Magento\Framework\UrlInterface
     */
    protected $urlBuilder;

    /**
     * CustomButton constructor.
     *
     * @param \Magento\Backend\Block\Widget\Context $context
     */
    public function __construct(
        \Magento\Backend\Block\Widget\Context $context,
         \Magento\Framework\App\Request\Http $request
    ) {
        $this->urlBuilder = $context->getUrlBuilder();
         $this->request = $request;
    }
    /**
     * @return array
     */
    public function getButtonData()
    {

         $id= $this->request->getParam('id');
        $data = [
            'label' => __('Reject Offer'),
            'class' => 'reject',
            'id' => 'custom-button',
            'on_click' => sprintf("location.href = '%s';", $this->getUrl('*/*/rejectoffer', ['id' =>  $id])),
            'sort_order' => 70
        ];
        return $data;
    }

    /**
     * Generate url by route and parameters
     *
     * @param   string $route
     * @param   array $params
     * @return  string
     */
    public function getUrl($route = '', $params = [])
    {
        return $this->urlBuilder->getUrl($route, $params);
    }
}

Now when once the offer is rejected the button don't need to be shown how can I set this??? I can get the data and set the logic for this but the issue is how can I disable button from here?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.