<?php

namespace FiloBlu\Esb\Block\Adminhtml\Queue\View;

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

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

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

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

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