123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?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);
- }
- }
|