<?php /** * Copyright © 2016 Ihor Vansach (ihor@magefan.com). All rights reserved. * See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php). * * Glory to Ukraine! Glory to the heroes! */ namespace Magefan\Blog\Block\Adminhtml\Edit; use Magento\Backend\Block\Widget\Context; use Magento\Framework\Exception\NoSuchEntityException; /** * Class GenericButton */ class GenericButton { /** * @var Context */ protected $context; /** * @param Context $context * @param BlockRepositoryInterface $blockRepository */ public function __construct( Context $context ) { $this->context = $context; } /** * Return CMS block ID * * @return int|null */ public function getPostId() { return $this->context->getRequest()->getParam('id'); } /** * Generate url by route and parameters * * @param string $route * @param array $params * @return string */ public function getUrl($route = '', $params = []) { return $this->context->getUrlBuilder()->getUrl($route, $params); } }