0

I refered to https://www.magestore.com/magento-2-tutorial/how-to-create-an-admin-form-look-like-a-configuration-page-magento-2-configuration-p3/ but there is an issue.

namespace Demo\Pro\Controller\Adminhtml\Index;

class Configuration extends \Magento\Backend\App\Action
{


/**
    * @var PageFactory
    */
    protected $resultPageFactory;

    /**
 * constructor
 *@param Context $context
 *@param PageFactory $resultPageFactory;
 * @return void
 */
protected function _construct(
    \Magento\Backend\App\Action\Context $context,
     \Magento\Framework\View\Result\PageFactory $resultPageFactory
) {
    parent::_construct($context);
    $this->resultPageFactory = $resultPageFactory;
}

/**
* Index action
*
*@return \Magento\Backend\Model\View\Result\Page
*/
public function execute()
{
    /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
    $resultPage = $this->resultPageFactory->create();
    $this->getRequest()->setParam('section','demo_pro');
    $resultPage->setActiveMenu('Demo_Pro::Configuration');
    $resultPage->getConfig()->getTitle()->prepend(__('SL Pages Authentication'));
    return $resultPage;
}
}
  • This is the error - Fatal error: Call to a member function create() on null in \Controller\Adminhtml\Index\Configuration.php on line 50 – subhas Oct 4 '17 at 15:24
0

Change your constructor to public and add one more underscore to your constructors name and it's parent too. May fix it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.