0

I am getting the following error while trying to create admin form with an editor(wysiwyg editor). Can someone please let me know what might be the issue?

Exception #0 (Magento\Framework\Exception\LocalizedException): Invalid method Company\MyModule\Block\Adminhtml\Article\Edit\Form::_initAction

* Updated with class Edit *

<?php
namespace MyCompany\MyModule\Block\Adminhtml\Article;

class Edit extends \Magento\Backend\Block\Widget\Form\Container   {
   protected $_registry;
   public function __construct(
      \Magento\Backend\Block\Widget\Context $context,
      \Magento\Framework\Registry $registry
   )  {
      $this->_registry = $registry;
      parent::__construct($context);
   }

   protected function _construct()  {
      $this->_objectId = 'id';
      $this->_controller = 'adminhtml_article';
      $this->_blockGroup = 'MyCompany_MyModule';
      parent::_construct();
      $this->buttonList->update('save', 'label', __('Save'));
      $this->buttonList->add(
          "saveandcontinue",
          [
          'label' => __('Save & Continue Edit'),
          'class' => 'save',
          'data_attribute' => [
             'mage-init' => [
                'button' => [
                   'event' => 'saveAndContinueEdit',
                   'target' => '#edit_form'
                ]
             ]
          ]
          ],
          -100
      );
      $this->buttonList->update('delete', 'label', __('Delete'));
   }
   public function getHeaderText()  {
      $registry = $this->_registry->registry('mymodulearticle');
      if ($registry->getId()) {
         $title = $this->escapeHtml($registry->getTitle());
         return __("Edit Article: '%1'", $title);
      } else {
         return __("New Article");
      }
   }
}
  • Please share your module block file which located in "/Block/Adminhtml/ " which one extended to "Widget\Container\" in your question so it's a better way to find a solution. – Dhrumin Mar 5 '18 at 8:45
  • Updated the post with the module block file. – Anish Karim Mar 5 '18 at 10:03
  • Sorry, an unwanted statement brings up this error. Tooks some time to find out the issue. Thank you all for the support. – Anish Karim Mar 5 '18 at 11:10

Your Answer

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

Browse other questions tagged or ask your own question.