I want to show the button in my custom module (admin page)
but I am getting an error
I want to add a button and how I add action process for that button
i already tried this answer : (https://magento.stackexchange.com/a/212656/73525 )
GenericButton.php
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Webkul\Mpquotesystem\Block\Adminhtml\Managequotes\Edit;
use Magento\Backend\Block\Widget\Context;
//use FME\News\Api\NewsRepositoryInterface;
use Magento\Framework\Exception\NoSuchEntityException;
/**
* Class GenericButton
*/
class GenericButton
{
/**
* @var Context
*/
protected $context;
/**
* @var BlockRepositoryInterface
*/
protected $blockRepository;
/**
* @param Context $context
* @param BlockRepositoryInterface $blockRepository
*/
public function __construct(
Context $context
) {
$this->context = $context;
//$this->blockRepository = $blockRepository;
}
/**
* Return CMS block ID
*
* @return int|null
*/
public function getBlockId()
{
/*
{
return $this->blockRepository->getById(
$this->context->getRequest()->getParam('news_id')
)->getId();
} */
return null;
}
/**
* 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);
}
}
SaveandContinuebutton.php
<?php
namespace Webkul\Mpquotesystem\Block\Adminhtml\Managequotes\Edit;
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
/**
* Class SaveAndContinueButton
*/
class SaveAndContinueButton extends GenericButton implements ButtonProviderInterface
{
public function getButtonData()
{
return [
'label' => __('ADmin pproval'),
'class' => 'save',
'on_click' => 'location.reload();',
'sort_order' => 30
];
}
}
view/adminhtml/uicomponent/custommodule_edit.xml
<?xml version="1.0"?>
<!-- /**
* Webkul Software
*
* @category Webkul
* @package Webkul_Mpquotesystem
* @author Webkul
* @copyright Copyright (c) 2010-2018 Webkul Software Private Limited (https://webkul.com)
* @license https://store.webkul.com/license.html
*/ -->
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<argument name="data" xsi:type="array">
<item name="buttons" xsi:type="array">
<item name="save_and_continue" xsi:type="string">Webkul\Mpquotesystem\Block\Adminhtml\Managequotes\Edit\SaveAndContinueButton</item>
</item>
</argument>
</form>
when clicking that admin custom module page :
Fatal error: Method Magento\Ui\TemplateEngine\Xhtml\Result::__toString() must not throw an exception, caught Error: Call to a member function getRequestFieldName() on null in /var/www/html/equpo2/vendor/magento/module-ui/Component/Wrapper/UiComponent.php on line