<?php

namespace FiloBlu\Esb\Block\Adminhtml\Producer\Edit;

use FiloBlu\Esb\Block\Adminhtml\Common\Button;

/**
 * Class BackButton
 */
class DeleteButton extends Button
{

    /**
     * @return array
     */
    public function getButtonData()
    {
        if ($this->getId() === null) {
            return [];
        }

        return [
            'label' => __('Delete'),
            'class' => 'delete action-secondary',
            'on_click' => 'deleteConfirm(\''
                . __('Are you sure you want to delete this producer ?')
                . '\', \'' . $this->getUrl('*/*/delete', ['id' => $this->getId()]) . '\')',
            'sort_order' => 20,
        ];
    }

    protected function getId()
    {
        return $this->context->getRequest()->getParam('id', null);
    }
}
