Custom Admin Edit form Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm...

Why aren't road bike wheels tiny?

Kepler's 3rd law: ratios don't fit data

What is her name?

How to get a single big right brace?

Salesforce - multiple pre production environments

What were wait-states, and why was it only an issue for PCs?

How do I deal with an erroneously large refund?

Should man-made satellites feature an intelligent inverted "cow catcher"?

Is there a verb for listening stealthily?

How to mute a string and play another at the same time

Does using the Inspiration rules for character defects encourage My Guy Syndrome?

Why does BitLocker not use RSA?

Can gravitational waves pass through a black hole?

What came first? Venom as the movie or as the song?

Coin Game with infinite paradox

Can the van der Waals coefficients be negative in the van der Waals equation for real gases?

Do chord progressions usually move by fifths?

Raising a bilingual kid. When should we introduce the majority language?

Meaning of "Not holding on that level of emuna/bitachon"

A journey... into the MIND

Why do C and C++ allow the expression (int) + 4*5?

Does the Pact of the Blade warlock feature allow me to customize the properties of the pact weapon I create?

/bin/ls sorts differently than just ls

How to create a command for the "strange m" symbol in latex?



Custom Admin Edit form



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?I created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?Magento 2 admin form controller errorMagento 2 Add new field to Magento_User admin formForm is not displayed on panel admin Magento 2Magento 2: Add a product to the cart programmaticallyMagento 2 Create dynamic array From different Model Collection to use in multi select in gridmagento 2.2.5: Adding Custom Attribute to Customer Edit Form in AdminChange value of text field in admin form based on option selected in dropdownMagento 2.3 Can't view module's front end page output?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I'm having some difficulty setting up an edit form within my custom module, when i inspect i see the header "New Manufacturer", but the div which would typically be rendered with the class "page-content" is missing.enter image description here



I've specified the block as below:



<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="editor"/>
<body>
<referenceContainer name="content">
<block class="AmritaManufacturerBlockAdminhtmlGridEdit" name="manufacturer_edit"/>
</referenceContainer>
</body>
</page>


The block looks like this:



<?php
namespace AmritaManufacturerBlockAdminhtmlGrid;

class Edit extends MagentoBackendBlockWidgetFormContainer
{
protected $_coreRegistry = null;

public function __construct(
MagentoBackendBlockWidgetContext $context,
MagentoFrameworkRegistry $registry,
array $data = []
) {
$this->_coreRegistry = $registry;
parent::__construct($context, $data);
}

protected function _construct()
{
$this->_objectId = 'manufacturer_id';
$this->_blockGroup = 'Amrita_Manufacturer';
$this->_controller = 'adminhtml_grid';


parent::_construct();

if ($this->_isAllowedAction('Amrita_Manufacturer::save_manufacturer')) {
$this->buttonList->update('save', 'label', __('Save Manufacturer'));
$this->buttonList->add(
'saveandcontinue',
[
'label' => __('Save and Continue Edit'),
'class' => 'save',
'data_attribute' => [
'mage-init' => [
'button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form'],
],
]
],
-100
);
} else {
$this->buttonList->remove('save');
}

if ($this->_isAllowedAction('Amrita_Manufacturer::delete_manufacturer')) {
$this->buttonList->update('delete', 'label', __('Delete Manufacturer'));
} else {
$this->buttonList->remove('delete');
}
}

public function getModel()
{
return $this->_coreRegistry->registry('manufacturer_grid');
}

public function getHeaderText()
{
if ($this->getModel()->getId()) {
return __("Edit Manufacturer '%1'", $this->escapeHtml($this->getModel()->getTitle()));
} else {
return __('New Manufacturer');
}
}

/**
* Check permission for passed action
*
* @param string $resourceId
* @return bool
*/
protected function _isAllowedAction($resourceId)
{
return $this->_authorization->isAllowed($resourceId);
}

/**
* Getter of url for "Save and Continue" button
* tab_id will be replaced by desired by JS later
*
* @return string
*/
protected function _getSaveAndContinueUrl()
{
return $this->getUrl('manufacturer/*/save', ['_current' => true, 'back' => 'edit', 'active_tab' => '']);
}
}


The Form.php is as follows:



<?php

namespace AmritaManufacturerBlockAdminhtmlGridEdit;

use MagentoBackendBlockWidgetFormGeneric;

class Form extends Generic
{

/**
* @var MagentoStoreModelSystemStore
*/
protected $_systemStore;
/**
* @param MagentoBackendBlockTemplateContext $context
* @param MagentoFrameworkRegistry $registry
* @param MagentoFrameworkDataFormFactory $formFactory
* @param MagentoCmsModelWysiwygConfig $wysiwygConfig
* @param MagentoStoreModelSystemStore $systemStore
* @param array $data
*/
public function __construct(
MagentoBackendBlockTemplateContext $context,
MagentoFrameworkRegistry $registry,
MagentoFrameworkDataFormFactory $formFactory,
MagentoStoreModelSystemStore $systemStore,
array $data = []
) {
$this->_systemStore = $systemStore;
parent::__construct($context, $registry, $formFactory, $data);
}

/**
* Init form
*
* @return void
*/
protected function _construct()
{
parent::_construct();
$this->setId('manufacturer_form');
$this->setTitle(__('Manufacturer Information'));
}

public function getModel()
{
return $this->_coreRegistry->registry('manufacturer_grid');
}

/**
* Prepare form
*
* @return $this
*/
protected function _prepareForm()
{
$model = $this->getModel();

/** @var MagentoFrameworkDataForm $form */
$form = $this->_formFactory->create(
['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']]
);

$form->setHtmlIdPrefix('manufacturer_');

$fieldset = $form->addFieldset(
'base_fieldset',
['legend' => __('General Information'), 'class' => 'fieldset-wide']
);

if ($model->getManufacturerId()) {
$fieldset->addField('manufacturer_id', 'hidden', ['name' => 'manufacturer_id']);
}

$fieldset->addField(
'title',
'text',
['name' => 'title', 'label' => __('Manufacturer Title'), 'title' => __('Manufacturer Title'), 'required' => true]
);

$fieldset->addField(
'description',
'editor',
[
'name' => 'description',
'label' => __('Description'),
'title' => __('Description'),
'style' => 'height:36em',
'required' => true
]
);

$fieldset->addField(
'is_enabled',
'select',
[
'label' => __('Status'),
'title' => __('Status'),
'name' => 'is_enabled',
'required' => true,
'options' => ['1' => __('Enabled'), '0' => __('Disabled')]
]
);
if (!$model->getId()) {
$model->setData('is_enabled', '1');
}

$fieldset->addField(
'is_restricted',
'select',
[
'label' => __('Product Permissions'),
'title' => __('Product Permissions'),
'name' => 'is_restricted',
'required' => true,
'options' => ['1' => __('Restricted'), '0' => __('Unrestricted')]
]
);
if (!$model->getId()) {
$model->setData('is_restricted', '1');
}

$form->setValues($model->getData());
$form->setUseContainer(true);
$this->setForm($form);

return parent::_prepareForm();
}
}


The new action is as follows:



<?php
namespace AmritaManufacturerControllerAdminhtmlGrid;

class NewAction extends MagentoBackendAppAction
{

protected $resultForwardFactory;

public function __construct(
MagentoBackendAppActionContext $context,
MagentoBackendModelViewResultForwardFactory $resultForwardFactory
) {
$this->resultForwardFactory = $resultForwardFactory;
parent::__construct($context);
}

public function execute()
{
/** @var MagentoBackendModelViewResultForward $resultForward */
$resultForward = $this->resultForwardFactory->create();
return $resultForward->forward('edit');
}

protected function _isAllowed()
{
return $this->_authorization->isAllowed('Amrita_Manufacturer::save_manufacturer');
}
}


The edit action is as follows:



<?php
namespace AmritaManufacturerControllerAdminhtmlGrid;

use MagentoBackendAppAction;

class Edit extends MagentoBackendAppAction
{
protected $_coreRegistry = null;

protected $resultPageFactory;

public function __construct(
ActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkRegistry $registry
) {
$this->resultPageFactory = $resultPageFactory;
$this->_coreRegistry = $registry;
parent::__construct($context);
}

/**
* {@inheritdoc}
*/
protected function _isAllowed()
{
return $this->_authorization->isAllowed('Amrita_Manufacturer::save_manufacturer');
}

/**
* Init actions
*
* @return MagentoBackendModelViewResultPage
*/
protected function _initAction()
{
// load layout, set active menu and breadcrumbs
/** @var MagentoBackendModelViewResultPage $resultPage */
$resultPage = $this->resultPageFactory->create();
$resultPage->setActiveMenu('Amrita_Manufacturer::amrita_manufacturergrid')
->addBreadcrumb(__('Manufacturers'), __('Manufacturers'))
->addBreadcrumb(__('Manage Manufacturers'), __('Manage Manufacturers'));
return $resultPage;
}

/**
* Edit Blog post
*
* @return MagentoBackendModelViewResultPage|MagentoBackendModelViewResultRedirect
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function execute()
{
$id = $this->getRequest()->getParam('manufacturer_id');
$model = $this->_objectManager->create('AmritaManufacturerModelManufacturer');

if ($id) {
$model->load($id);
if (!$model->getId()) {
$this->messageManager->addError(__('This manufacturer no longer exists.'));
/** MagentoBackendModelViewResultRedirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();

return $resultRedirect->setPath('*/*/');
}
}

$data = $this->_objectManager->get('MagentoBackendModelSession')->getFormData(true);
if (!empty($data)) {
$model->setData($data);
}

$this->_coreRegistry->register('manufacturer_grid', $model);

/** @var MagentoBackendModelViewResultPage $resultPage */
$resultPage = $this->_initAction();
$resultPage->addBreadcrumb(
$id ? __('Edit Manufacturer') : __('New Manufacturer'),
$id ? __('Edit Manufacturer') : __('New Manufacturer')
);
$resultPage->getConfig()->getTitle()->prepend(__('Manufacturers'));
$resultPage->getConfig()->getTitle()
->prepend($model->getId() ? $model->getTitle() : __('New Manufacturer'));

return $resultPage;
}
}


I have a few questions:




  1. the method getManufacturerId() in the form.php, where/how is
    this defined.

  2. what should I add to the core registry? Is it the Cache_tag as
    defined in the model Manufacturer.php?
    $this->_coreRegistry->registry('manufacturer_grid');










share|improve this question
















bumped to the homepage by Community 2 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















    0















    I'm having some difficulty setting up an edit form within my custom module, when i inspect i see the header "New Manufacturer", but the div which would typically be rendered with the class "page-content" is missing.enter image description here



    I've specified the block as below:



    <?xml version="1.0"?>
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="editor"/>
    <body>
    <referenceContainer name="content">
    <block class="AmritaManufacturerBlockAdminhtmlGridEdit" name="manufacturer_edit"/>
    </referenceContainer>
    </body>
    </page>


    The block looks like this:



    <?php
    namespace AmritaManufacturerBlockAdminhtmlGrid;

    class Edit extends MagentoBackendBlockWidgetFormContainer
    {
    protected $_coreRegistry = null;

    public function __construct(
    MagentoBackendBlockWidgetContext $context,
    MagentoFrameworkRegistry $registry,
    array $data = []
    ) {
    $this->_coreRegistry = $registry;
    parent::__construct($context, $data);
    }

    protected function _construct()
    {
    $this->_objectId = 'manufacturer_id';
    $this->_blockGroup = 'Amrita_Manufacturer';
    $this->_controller = 'adminhtml_grid';


    parent::_construct();

    if ($this->_isAllowedAction('Amrita_Manufacturer::save_manufacturer')) {
    $this->buttonList->update('save', 'label', __('Save Manufacturer'));
    $this->buttonList->add(
    'saveandcontinue',
    [
    'label' => __('Save and Continue Edit'),
    'class' => 'save',
    'data_attribute' => [
    'mage-init' => [
    'button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form'],
    ],
    ]
    ],
    -100
    );
    } else {
    $this->buttonList->remove('save');
    }

    if ($this->_isAllowedAction('Amrita_Manufacturer::delete_manufacturer')) {
    $this->buttonList->update('delete', 'label', __('Delete Manufacturer'));
    } else {
    $this->buttonList->remove('delete');
    }
    }

    public function getModel()
    {
    return $this->_coreRegistry->registry('manufacturer_grid');
    }

    public function getHeaderText()
    {
    if ($this->getModel()->getId()) {
    return __("Edit Manufacturer '%1'", $this->escapeHtml($this->getModel()->getTitle()));
    } else {
    return __('New Manufacturer');
    }
    }

    /**
    * Check permission for passed action
    *
    * @param string $resourceId
    * @return bool
    */
    protected function _isAllowedAction($resourceId)
    {
    return $this->_authorization->isAllowed($resourceId);
    }

    /**
    * Getter of url for "Save and Continue" button
    * tab_id will be replaced by desired by JS later
    *
    * @return string
    */
    protected function _getSaveAndContinueUrl()
    {
    return $this->getUrl('manufacturer/*/save', ['_current' => true, 'back' => 'edit', 'active_tab' => '']);
    }
    }


    The Form.php is as follows:



    <?php

    namespace AmritaManufacturerBlockAdminhtmlGridEdit;

    use MagentoBackendBlockWidgetFormGeneric;

    class Form extends Generic
    {

    /**
    * @var MagentoStoreModelSystemStore
    */
    protected $_systemStore;
    /**
    * @param MagentoBackendBlockTemplateContext $context
    * @param MagentoFrameworkRegistry $registry
    * @param MagentoFrameworkDataFormFactory $formFactory
    * @param MagentoCmsModelWysiwygConfig $wysiwygConfig
    * @param MagentoStoreModelSystemStore $systemStore
    * @param array $data
    */
    public function __construct(
    MagentoBackendBlockTemplateContext $context,
    MagentoFrameworkRegistry $registry,
    MagentoFrameworkDataFormFactory $formFactory,
    MagentoStoreModelSystemStore $systemStore,
    array $data = []
    ) {
    $this->_systemStore = $systemStore;
    parent::__construct($context, $registry, $formFactory, $data);
    }

    /**
    * Init form
    *
    * @return void
    */
    protected function _construct()
    {
    parent::_construct();
    $this->setId('manufacturer_form');
    $this->setTitle(__('Manufacturer Information'));
    }

    public function getModel()
    {
    return $this->_coreRegistry->registry('manufacturer_grid');
    }

    /**
    * Prepare form
    *
    * @return $this
    */
    protected function _prepareForm()
    {
    $model = $this->getModel();

    /** @var MagentoFrameworkDataForm $form */
    $form = $this->_formFactory->create(
    ['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']]
    );

    $form->setHtmlIdPrefix('manufacturer_');

    $fieldset = $form->addFieldset(
    'base_fieldset',
    ['legend' => __('General Information'), 'class' => 'fieldset-wide']
    );

    if ($model->getManufacturerId()) {
    $fieldset->addField('manufacturer_id', 'hidden', ['name' => 'manufacturer_id']);
    }

    $fieldset->addField(
    'title',
    'text',
    ['name' => 'title', 'label' => __('Manufacturer Title'), 'title' => __('Manufacturer Title'), 'required' => true]
    );

    $fieldset->addField(
    'description',
    'editor',
    [
    'name' => 'description',
    'label' => __('Description'),
    'title' => __('Description'),
    'style' => 'height:36em',
    'required' => true
    ]
    );

    $fieldset->addField(
    'is_enabled',
    'select',
    [
    'label' => __('Status'),
    'title' => __('Status'),
    'name' => 'is_enabled',
    'required' => true,
    'options' => ['1' => __('Enabled'), '0' => __('Disabled')]
    ]
    );
    if (!$model->getId()) {
    $model->setData('is_enabled', '1');
    }

    $fieldset->addField(
    'is_restricted',
    'select',
    [
    'label' => __('Product Permissions'),
    'title' => __('Product Permissions'),
    'name' => 'is_restricted',
    'required' => true,
    'options' => ['1' => __('Restricted'), '0' => __('Unrestricted')]
    ]
    );
    if (!$model->getId()) {
    $model->setData('is_restricted', '1');
    }

    $form->setValues($model->getData());
    $form->setUseContainer(true);
    $this->setForm($form);

    return parent::_prepareForm();
    }
    }


    The new action is as follows:



    <?php
    namespace AmritaManufacturerControllerAdminhtmlGrid;

    class NewAction extends MagentoBackendAppAction
    {

    protected $resultForwardFactory;

    public function __construct(
    MagentoBackendAppActionContext $context,
    MagentoBackendModelViewResultForwardFactory $resultForwardFactory
    ) {
    $this->resultForwardFactory = $resultForwardFactory;
    parent::__construct($context);
    }

    public function execute()
    {
    /** @var MagentoBackendModelViewResultForward $resultForward */
    $resultForward = $this->resultForwardFactory->create();
    return $resultForward->forward('edit');
    }

    protected function _isAllowed()
    {
    return $this->_authorization->isAllowed('Amrita_Manufacturer::save_manufacturer');
    }
    }


    The edit action is as follows:



    <?php
    namespace AmritaManufacturerControllerAdminhtmlGrid;

    use MagentoBackendAppAction;

    class Edit extends MagentoBackendAppAction
    {
    protected $_coreRegistry = null;

    protected $resultPageFactory;

    public function __construct(
    ActionContext $context,
    MagentoFrameworkViewResultPageFactory $resultPageFactory,
    MagentoFrameworkRegistry $registry
    ) {
    $this->resultPageFactory = $resultPageFactory;
    $this->_coreRegistry = $registry;
    parent::__construct($context);
    }

    /**
    * {@inheritdoc}
    */
    protected function _isAllowed()
    {
    return $this->_authorization->isAllowed('Amrita_Manufacturer::save_manufacturer');
    }

    /**
    * Init actions
    *
    * @return MagentoBackendModelViewResultPage
    */
    protected function _initAction()
    {
    // load layout, set active menu and breadcrumbs
    /** @var MagentoBackendModelViewResultPage $resultPage */
    $resultPage = $this->resultPageFactory->create();
    $resultPage->setActiveMenu('Amrita_Manufacturer::amrita_manufacturergrid')
    ->addBreadcrumb(__('Manufacturers'), __('Manufacturers'))
    ->addBreadcrumb(__('Manage Manufacturers'), __('Manage Manufacturers'));
    return $resultPage;
    }

    /**
    * Edit Blog post
    *
    * @return MagentoBackendModelViewResultPage|MagentoBackendModelViewResultRedirect
    * @SuppressWarnings(PHPMD.NPathComplexity)
    */
    public function execute()
    {
    $id = $this->getRequest()->getParam('manufacturer_id');
    $model = $this->_objectManager->create('AmritaManufacturerModelManufacturer');

    if ($id) {
    $model->load($id);
    if (!$model->getId()) {
    $this->messageManager->addError(__('This manufacturer no longer exists.'));
    /** MagentoBackendModelViewResultRedirect $resultRedirect */
    $resultRedirect = $this->resultRedirectFactory->create();

    return $resultRedirect->setPath('*/*/');
    }
    }

    $data = $this->_objectManager->get('MagentoBackendModelSession')->getFormData(true);
    if (!empty($data)) {
    $model->setData($data);
    }

    $this->_coreRegistry->register('manufacturer_grid', $model);

    /** @var MagentoBackendModelViewResultPage $resultPage */
    $resultPage = $this->_initAction();
    $resultPage->addBreadcrumb(
    $id ? __('Edit Manufacturer') : __('New Manufacturer'),
    $id ? __('Edit Manufacturer') : __('New Manufacturer')
    );
    $resultPage->getConfig()->getTitle()->prepend(__('Manufacturers'));
    $resultPage->getConfig()->getTitle()
    ->prepend($model->getId() ? $model->getTitle() : __('New Manufacturer'));

    return $resultPage;
    }
    }


    I have a few questions:




    1. the method getManufacturerId() in the form.php, where/how is
      this defined.

    2. what should I add to the core registry? Is it the Cache_tag as
      defined in the model Manufacturer.php?
      $this->_coreRegistry->registry('manufacturer_grid');










    share|improve this question
















    bumped to the homepage by Community 2 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      0












      0








      0








      I'm having some difficulty setting up an edit form within my custom module, when i inspect i see the header "New Manufacturer", but the div which would typically be rendered with the class "page-content" is missing.enter image description here



      I've specified the block as below:



      <?xml version="1.0"?>
      <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
      <update handle="editor"/>
      <body>
      <referenceContainer name="content">
      <block class="AmritaManufacturerBlockAdminhtmlGridEdit" name="manufacturer_edit"/>
      </referenceContainer>
      </body>
      </page>


      The block looks like this:



      <?php
      namespace AmritaManufacturerBlockAdminhtmlGrid;

      class Edit extends MagentoBackendBlockWidgetFormContainer
      {
      protected $_coreRegistry = null;

      public function __construct(
      MagentoBackendBlockWidgetContext $context,
      MagentoFrameworkRegistry $registry,
      array $data = []
      ) {
      $this->_coreRegistry = $registry;
      parent::__construct($context, $data);
      }

      protected function _construct()
      {
      $this->_objectId = 'manufacturer_id';
      $this->_blockGroup = 'Amrita_Manufacturer';
      $this->_controller = 'adminhtml_grid';


      parent::_construct();

      if ($this->_isAllowedAction('Amrita_Manufacturer::save_manufacturer')) {
      $this->buttonList->update('save', 'label', __('Save Manufacturer'));
      $this->buttonList->add(
      'saveandcontinue',
      [
      'label' => __('Save and Continue Edit'),
      'class' => 'save',
      'data_attribute' => [
      'mage-init' => [
      'button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form'],
      ],
      ]
      ],
      -100
      );
      } else {
      $this->buttonList->remove('save');
      }

      if ($this->_isAllowedAction('Amrita_Manufacturer::delete_manufacturer')) {
      $this->buttonList->update('delete', 'label', __('Delete Manufacturer'));
      } else {
      $this->buttonList->remove('delete');
      }
      }

      public function getModel()
      {
      return $this->_coreRegistry->registry('manufacturer_grid');
      }

      public function getHeaderText()
      {
      if ($this->getModel()->getId()) {
      return __("Edit Manufacturer '%1'", $this->escapeHtml($this->getModel()->getTitle()));
      } else {
      return __('New Manufacturer');
      }
      }

      /**
      * Check permission for passed action
      *
      * @param string $resourceId
      * @return bool
      */
      protected function _isAllowedAction($resourceId)
      {
      return $this->_authorization->isAllowed($resourceId);
      }

      /**
      * Getter of url for "Save and Continue" button
      * tab_id will be replaced by desired by JS later
      *
      * @return string
      */
      protected function _getSaveAndContinueUrl()
      {
      return $this->getUrl('manufacturer/*/save', ['_current' => true, 'back' => 'edit', 'active_tab' => '']);
      }
      }


      The Form.php is as follows:



      <?php

      namespace AmritaManufacturerBlockAdminhtmlGridEdit;

      use MagentoBackendBlockWidgetFormGeneric;

      class Form extends Generic
      {

      /**
      * @var MagentoStoreModelSystemStore
      */
      protected $_systemStore;
      /**
      * @param MagentoBackendBlockTemplateContext $context
      * @param MagentoFrameworkRegistry $registry
      * @param MagentoFrameworkDataFormFactory $formFactory
      * @param MagentoCmsModelWysiwygConfig $wysiwygConfig
      * @param MagentoStoreModelSystemStore $systemStore
      * @param array $data
      */
      public function __construct(
      MagentoBackendBlockTemplateContext $context,
      MagentoFrameworkRegistry $registry,
      MagentoFrameworkDataFormFactory $formFactory,
      MagentoStoreModelSystemStore $systemStore,
      array $data = []
      ) {
      $this->_systemStore = $systemStore;
      parent::__construct($context, $registry, $formFactory, $data);
      }

      /**
      * Init form
      *
      * @return void
      */
      protected function _construct()
      {
      parent::_construct();
      $this->setId('manufacturer_form');
      $this->setTitle(__('Manufacturer Information'));
      }

      public function getModel()
      {
      return $this->_coreRegistry->registry('manufacturer_grid');
      }

      /**
      * Prepare form
      *
      * @return $this
      */
      protected function _prepareForm()
      {
      $model = $this->getModel();

      /** @var MagentoFrameworkDataForm $form */
      $form = $this->_formFactory->create(
      ['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']]
      );

      $form->setHtmlIdPrefix('manufacturer_');

      $fieldset = $form->addFieldset(
      'base_fieldset',
      ['legend' => __('General Information'), 'class' => 'fieldset-wide']
      );

      if ($model->getManufacturerId()) {
      $fieldset->addField('manufacturer_id', 'hidden', ['name' => 'manufacturer_id']);
      }

      $fieldset->addField(
      'title',
      'text',
      ['name' => 'title', 'label' => __('Manufacturer Title'), 'title' => __('Manufacturer Title'), 'required' => true]
      );

      $fieldset->addField(
      'description',
      'editor',
      [
      'name' => 'description',
      'label' => __('Description'),
      'title' => __('Description'),
      'style' => 'height:36em',
      'required' => true
      ]
      );

      $fieldset->addField(
      'is_enabled',
      'select',
      [
      'label' => __('Status'),
      'title' => __('Status'),
      'name' => 'is_enabled',
      'required' => true,
      'options' => ['1' => __('Enabled'), '0' => __('Disabled')]
      ]
      );
      if (!$model->getId()) {
      $model->setData('is_enabled', '1');
      }

      $fieldset->addField(
      'is_restricted',
      'select',
      [
      'label' => __('Product Permissions'),
      'title' => __('Product Permissions'),
      'name' => 'is_restricted',
      'required' => true,
      'options' => ['1' => __('Restricted'), '0' => __('Unrestricted')]
      ]
      );
      if (!$model->getId()) {
      $model->setData('is_restricted', '1');
      }

      $form->setValues($model->getData());
      $form->setUseContainer(true);
      $this->setForm($form);

      return parent::_prepareForm();
      }
      }


      The new action is as follows:



      <?php
      namespace AmritaManufacturerControllerAdminhtmlGrid;

      class NewAction extends MagentoBackendAppAction
      {

      protected $resultForwardFactory;

      public function __construct(
      MagentoBackendAppActionContext $context,
      MagentoBackendModelViewResultForwardFactory $resultForwardFactory
      ) {
      $this->resultForwardFactory = $resultForwardFactory;
      parent::__construct($context);
      }

      public function execute()
      {
      /** @var MagentoBackendModelViewResultForward $resultForward */
      $resultForward = $this->resultForwardFactory->create();
      return $resultForward->forward('edit');
      }

      protected function _isAllowed()
      {
      return $this->_authorization->isAllowed('Amrita_Manufacturer::save_manufacturer');
      }
      }


      The edit action is as follows:



      <?php
      namespace AmritaManufacturerControllerAdminhtmlGrid;

      use MagentoBackendAppAction;

      class Edit extends MagentoBackendAppAction
      {
      protected $_coreRegistry = null;

      protected $resultPageFactory;

      public function __construct(
      ActionContext $context,
      MagentoFrameworkViewResultPageFactory $resultPageFactory,
      MagentoFrameworkRegistry $registry
      ) {
      $this->resultPageFactory = $resultPageFactory;
      $this->_coreRegistry = $registry;
      parent::__construct($context);
      }

      /**
      * {@inheritdoc}
      */
      protected function _isAllowed()
      {
      return $this->_authorization->isAllowed('Amrita_Manufacturer::save_manufacturer');
      }

      /**
      * Init actions
      *
      * @return MagentoBackendModelViewResultPage
      */
      protected function _initAction()
      {
      // load layout, set active menu and breadcrumbs
      /** @var MagentoBackendModelViewResultPage $resultPage */
      $resultPage = $this->resultPageFactory->create();
      $resultPage->setActiveMenu('Amrita_Manufacturer::amrita_manufacturergrid')
      ->addBreadcrumb(__('Manufacturers'), __('Manufacturers'))
      ->addBreadcrumb(__('Manage Manufacturers'), __('Manage Manufacturers'));
      return $resultPage;
      }

      /**
      * Edit Blog post
      *
      * @return MagentoBackendModelViewResultPage|MagentoBackendModelViewResultRedirect
      * @SuppressWarnings(PHPMD.NPathComplexity)
      */
      public function execute()
      {
      $id = $this->getRequest()->getParam('manufacturer_id');
      $model = $this->_objectManager->create('AmritaManufacturerModelManufacturer');

      if ($id) {
      $model->load($id);
      if (!$model->getId()) {
      $this->messageManager->addError(__('This manufacturer no longer exists.'));
      /** MagentoBackendModelViewResultRedirect $resultRedirect */
      $resultRedirect = $this->resultRedirectFactory->create();

      return $resultRedirect->setPath('*/*/');
      }
      }

      $data = $this->_objectManager->get('MagentoBackendModelSession')->getFormData(true);
      if (!empty($data)) {
      $model->setData($data);
      }

      $this->_coreRegistry->register('manufacturer_grid', $model);

      /** @var MagentoBackendModelViewResultPage $resultPage */
      $resultPage = $this->_initAction();
      $resultPage->addBreadcrumb(
      $id ? __('Edit Manufacturer') : __('New Manufacturer'),
      $id ? __('Edit Manufacturer') : __('New Manufacturer')
      );
      $resultPage->getConfig()->getTitle()->prepend(__('Manufacturers'));
      $resultPage->getConfig()->getTitle()
      ->prepend($model->getId() ? $model->getTitle() : __('New Manufacturer'));

      return $resultPage;
      }
      }


      I have a few questions:




      1. the method getManufacturerId() in the form.php, where/how is
        this defined.

      2. what should I add to the core registry? Is it the Cache_tag as
        defined in the model Manufacturer.php?
        $this->_coreRegistry->registry('manufacturer_grid');










      share|improve this question
















      I'm having some difficulty setting up an edit form within my custom module, when i inspect i see the header "New Manufacturer", but the div which would typically be rendered with the class "page-content" is missing.enter image description here



      I've specified the block as below:



      <?xml version="1.0"?>
      <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
      <update handle="editor"/>
      <body>
      <referenceContainer name="content">
      <block class="AmritaManufacturerBlockAdminhtmlGridEdit" name="manufacturer_edit"/>
      </referenceContainer>
      </body>
      </page>


      The block looks like this:



      <?php
      namespace AmritaManufacturerBlockAdminhtmlGrid;

      class Edit extends MagentoBackendBlockWidgetFormContainer
      {
      protected $_coreRegistry = null;

      public function __construct(
      MagentoBackendBlockWidgetContext $context,
      MagentoFrameworkRegistry $registry,
      array $data = []
      ) {
      $this->_coreRegistry = $registry;
      parent::__construct($context, $data);
      }

      protected function _construct()
      {
      $this->_objectId = 'manufacturer_id';
      $this->_blockGroup = 'Amrita_Manufacturer';
      $this->_controller = 'adminhtml_grid';


      parent::_construct();

      if ($this->_isAllowedAction('Amrita_Manufacturer::save_manufacturer')) {
      $this->buttonList->update('save', 'label', __('Save Manufacturer'));
      $this->buttonList->add(
      'saveandcontinue',
      [
      'label' => __('Save and Continue Edit'),
      'class' => 'save',
      'data_attribute' => [
      'mage-init' => [
      'button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form'],
      ],
      ]
      ],
      -100
      );
      } else {
      $this->buttonList->remove('save');
      }

      if ($this->_isAllowedAction('Amrita_Manufacturer::delete_manufacturer')) {
      $this->buttonList->update('delete', 'label', __('Delete Manufacturer'));
      } else {
      $this->buttonList->remove('delete');
      }
      }

      public function getModel()
      {
      return $this->_coreRegistry->registry('manufacturer_grid');
      }

      public function getHeaderText()
      {
      if ($this->getModel()->getId()) {
      return __("Edit Manufacturer '%1'", $this->escapeHtml($this->getModel()->getTitle()));
      } else {
      return __('New Manufacturer');
      }
      }

      /**
      * Check permission for passed action
      *
      * @param string $resourceId
      * @return bool
      */
      protected function _isAllowedAction($resourceId)
      {
      return $this->_authorization->isAllowed($resourceId);
      }

      /**
      * Getter of url for "Save and Continue" button
      * tab_id will be replaced by desired by JS later
      *
      * @return string
      */
      protected function _getSaveAndContinueUrl()
      {
      return $this->getUrl('manufacturer/*/save', ['_current' => true, 'back' => 'edit', 'active_tab' => '']);
      }
      }


      The Form.php is as follows:



      <?php

      namespace AmritaManufacturerBlockAdminhtmlGridEdit;

      use MagentoBackendBlockWidgetFormGeneric;

      class Form extends Generic
      {

      /**
      * @var MagentoStoreModelSystemStore
      */
      protected $_systemStore;
      /**
      * @param MagentoBackendBlockTemplateContext $context
      * @param MagentoFrameworkRegistry $registry
      * @param MagentoFrameworkDataFormFactory $formFactory
      * @param MagentoCmsModelWysiwygConfig $wysiwygConfig
      * @param MagentoStoreModelSystemStore $systemStore
      * @param array $data
      */
      public function __construct(
      MagentoBackendBlockTemplateContext $context,
      MagentoFrameworkRegistry $registry,
      MagentoFrameworkDataFormFactory $formFactory,
      MagentoStoreModelSystemStore $systemStore,
      array $data = []
      ) {
      $this->_systemStore = $systemStore;
      parent::__construct($context, $registry, $formFactory, $data);
      }

      /**
      * Init form
      *
      * @return void
      */
      protected function _construct()
      {
      parent::_construct();
      $this->setId('manufacturer_form');
      $this->setTitle(__('Manufacturer Information'));
      }

      public function getModel()
      {
      return $this->_coreRegistry->registry('manufacturer_grid');
      }

      /**
      * Prepare form
      *
      * @return $this
      */
      protected function _prepareForm()
      {
      $model = $this->getModel();

      /** @var MagentoFrameworkDataForm $form */
      $form = $this->_formFactory->create(
      ['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']]
      );

      $form->setHtmlIdPrefix('manufacturer_');

      $fieldset = $form->addFieldset(
      'base_fieldset',
      ['legend' => __('General Information'), 'class' => 'fieldset-wide']
      );

      if ($model->getManufacturerId()) {
      $fieldset->addField('manufacturer_id', 'hidden', ['name' => 'manufacturer_id']);
      }

      $fieldset->addField(
      'title',
      'text',
      ['name' => 'title', 'label' => __('Manufacturer Title'), 'title' => __('Manufacturer Title'), 'required' => true]
      );

      $fieldset->addField(
      'description',
      'editor',
      [
      'name' => 'description',
      'label' => __('Description'),
      'title' => __('Description'),
      'style' => 'height:36em',
      'required' => true
      ]
      );

      $fieldset->addField(
      'is_enabled',
      'select',
      [
      'label' => __('Status'),
      'title' => __('Status'),
      'name' => 'is_enabled',
      'required' => true,
      'options' => ['1' => __('Enabled'), '0' => __('Disabled')]
      ]
      );
      if (!$model->getId()) {
      $model->setData('is_enabled', '1');
      }

      $fieldset->addField(
      'is_restricted',
      'select',
      [
      'label' => __('Product Permissions'),
      'title' => __('Product Permissions'),
      'name' => 'is_restricted',
      'required' => true,
      'options' => ['1' => __('Restricted'), '0' => __('Unrestricted')]
      ]
      );
      if (!$model->getId()) {
      $model->setData('is_restricted', '1');
      }

      $form->setValues($model->getData());
      $form->setUseContainer(true);
      $this->setForm($form);

      return parent::_prepareForm();
      }
      }


      The new action is as follows:



      <?php
      namespace AmritaManufacturerControllerAdminhtmlGrid;

      class NewAction extends MagentoBackendAppAction
      {

      protected $resultForwardFactory;

      public function __construct(
      MagentoBackendAppActionContext $context,
      MagentoBackendModelViewResultForwardFactory $resultForwardFactory
      ) {
      $this->resultForwardFactory = $resultForwardFactory;
      parent::__construct($context);
      }

      public function execute()
      {
      /** @var MagentoBackendModelViewResultForward $resultForward */
      $resultForward = $this->resultForwardFactory->create();
      return $resultForward->forward('edit');
      }

      protected function _isAllowed()
      {
      return $this->_authorization->isAllowed('Amrita_Manufacturer::save_manufacturer');
      }
      }


      The edit action is as follows:



      <?php
      namespace AmritaManufacturerControllerAdminhtmlGrid;

      use MagentoBackendAppAction;

      class Edit extends MagentoBackendAppAction
      {
      protected $_coreRegistry = null;

      protected $resultPageFactory;

      public function __construct(
      ActionContext $context,
      MagentoFrameworkViewResultPageFactory $resultPageFactory,
      MagentoFrameworkRegistry $registry
      ) {
      $this->resultPageFactory = $resultPageFactory;
      $this->_coreRegistry = $registry;
      parent::__construct($context);
      }

      /**
      * {@inheritdoc}
      */
      protected function _isAllowed()
      {
      return $this->_authorization->isAllowed('Amrita_Manufacturer::save_manufacturer');
      }

      /**
      * Init actions
      *
      * @return MagentoBackendModelViewResultPage
      */
      protected function _initAction()
      {
      // load layout, set active menu and breadcrumbs
      /** @var MagentoBackendModelViewResultPage $resultPage */
      $resultPage = $this->resultPageFactory->create();
      $resultPage->setActiveMenu('Amrita_Manufacturer::amrita_manufacturergrid')
      ->addBreadcrumb(__('Manufacturers'), __('Manufacturers'))
      ->addBreadcrumb(__('Manage Manufacturers'), __('Manage Manufacturers'));
      return $resultPage;
      }

      /**
      * Edit Blog post
      *
      * @return MagentoBackendModelViewResultPage|MagentoBackendModelViewResultRedirect
      * @SuppressWarnings(PHPMD.NPathComplexity)
      */
      public function execute()
      {
      $id = $this->getRequest()->getParam('manufacturer_id');
      $model = $this->_objectManager->create('AmritaManufacturerModelManufacturer');

      if ($id) {
      $model->load($id);
      if (!$model->getId()) {
      $this->messageManager->addError(__('This manufacturer no longer exists.'));
      /** MagentoBackendModelViewResultRedirect $resultRedirect */
      $resultRedirect = $this->resultRedirectFactory->create();

      return $resultRedirect->setPath('*/*/');
      }
      }

      $data = $this->_objectManager->get('MagentoBackendModelSession')->getFormData(true);
      if (!empty($data)) {
      $model->setData($data);
      }

      $this->_coreRegistry->register('manufacturer_grid', $model);

      /** @var MagentoBackendModelViewResultPage $resultPage */
      $resultPage = $this->_initAction();
      $resultPage->addBreadcrumb(
      $id ? __('Edit Manufacturer') : __('New Manufacturer'),
      $id ? __('Edit Manufacturer') : __('New Manufacturer')
      );
      $resultPage->getConfig()->getTitle()->prepend(__('Manufacturers'));
      $resultPage->getConfig()->getTitle()
      ->prepend($model->getId() ? $model->getTitle() : __('New Manufacturer'));

      return $resultPage;
      }
      }


      I have a few questions:




      1. the method getManufacturerId() in the form.php, where/how is
        this defined.

      2. what should I add to the core registry? Is it the Cache_tag as
        defined in the model Manufacturer.php?
        $this->_coreRegistry->registry('manufacturer_grid');







      magento2 adminhtml adminform






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 27 '16 at 8:49









      Fabian Schmengler

      55.4k21139354




      55.4k21139354










      asked May 27 '16 at 8:29









      Sophie BaxterSophie Baxter

      190622




      190622





      bumped to the homepage by Community 2 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 2 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          3 Answers
          3






          active

          oldest

          votes


















          0














          Because of $this->_coreRegistry->register(), invalid core registry your form is not loading. Your core registry should be your model class, like $this->_coreRegistry->register(modulename_modelclass);






          share|improve this answer

































            0














            Please make sure that your layout configuration file has the same namespace name with route front name. For example: your route front name is manufacturer, and your layout configuration file name is manufacturer_grid_edit.






            share|improve this answer































              0














              You are missing layout defined in your xml file.
              set layout="admin-2columns-left" in your page tag.



              <?xml version="1.0"?>
              <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" layout="admin-2columns-left">
              <update handle="editor"/>
              <body>
              <referenceContainer name="content">
              <block class="AmritaManufacturerBlockAdminhtmlGridEdit" name="manufacturer_edit"/>
              </referenceContainer>
              </body>
              </page>





              share|improve this answer


























              • This hasn't resolved the problem. My assumption was that an admin layout would be specified by default. Also, in the example i'm following, no layout is specified. ashsmith.io/magento2/module-from-scratch-part-5-adminhtml

                – Sophie Baxter
                May 27 '16 at 11:04












              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "479"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f117226%2fcustom-admin-edit-form%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              Because of $this->_coreRegistry->register(), invalid core registry your form is not loading. Your core registry should be your model class, like $this->_coreRegistry->register(modulename_modelclass);






              share|improve this answer






























                0














                Because of $this->_coreRegistry->register(), invalid core registry your form is not loading. Your core registry should be your model class, like $this->_coreRegistry->register(modulename_modelclass);






                share|improve this answer




























                  0












                  0








                  0







                  Because of $this->_coreRegistry->register(), invalid core registry your form is not loading. Your core registry should be your model class, like $this->_coreRegistry->register(modulename_modelclass);






                  share|improve this answer















                  Because of $this->_coreRegistry->register(), invalid core registry your form is not loading. Your core registry should be your model class, like $this->_coreRegistry->register(modulename_modelclass);







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 1 '16 at 14:41









                  7ochem

                  5,86493770




                  5,86493770










                  answered Nov 1 '16 at 14:22









                  rajat kararajat kara

                  662521




                  662521

























                      0














                      Please make sure that your layout configuration file has the same namespace name with route front name. For example: your route front name is manufacturer, and your layout configuration file name is manufacturer_grid_edit.






                      share|improve this answer




























                        0














                        Please make sure that your layout configuration file has the same namespace name with route front name. For example: your route front name is manufacturer, and your layout configuration file name is manufacturer_grid_edit.






                        share|improve this answer


























                          0












                          0








                          0







                          Please make sure that your layout configuration file has the same namespace name with route front name. For example: your route front name is manufacturer, and your layout configuration file name is manufacturer_grid_edit.






                          share|improve this answer













                          Please make sure that your layout configuration file has the same namespace name with route front name. For example: your route front name is manufacturer, and your layout configuration file name is manufacturer_grid_edit.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jan 10 '17 at 6:57









                          Hùng Thế HiểnHùng Thế Hiển

                          17916




                          17916























                              0














                              You are missing layout defined in your xml file.
                              set layout="admin-2columns-left" in your page tag.



                              <?xml version="1.0"?>
                              <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                              xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" layout="admin-2columns-left">
                              <update handle="editor"/>
                              <body>
                              <referenceContainer name="content">
                              <block class="AmritaManufacturerBlockAdminhtmlGridEdit" name="manufacturer_edit"/>
                              </referenceContainer>
                              </body>
                              </page>





                              share|improve this answer


























                              • This hasn't resolved the problem. My assumption was that an admin layout would be specified by default. Also, in the example i'm following, no layout is specified. ashsmith.io/magento2/module-from-scratch-part-5-adminhtml

                                – Sophie Baxter
                                May 27 '16 at 11:04
















                              0














                              You are missing layout defined in your xml file.
                              set layout="admin-2columns-left" in your page tag.



                              <?xml version="1.0"?>
                              <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                              xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" layout="admin-2columns-left">
                              <update handle="editor"/>
                              <body>
                              <referenceContainer name="content">
                              <block class="AmritaManufacturerBlockAdminhtmlGridEdit" name="manufacturer_edit"/>
                              </referenceContainer>
                              </body>
                              </page>





                              share|improve this answer


























                              • This hasn't resolved the problem. My assumption was that an admin layout would be specified by default. Also, in the example i'm following, no layout is specified. ashsmith.io/magento2/module-from-scratch-part-5-adminhtml

                                – Sophie Baxter
                                May 27 '16 at 11:04














                              0












                              0








                              0







                              You are missing layout defined in your xml file.
                              set layout="admin-2columns-left" in your page tag.



                              <?xml version="1.0"?>
                              <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                              xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" layout="admin-2columns-left">
                              <update handle="editor"/>
                              <body>
                              <referenceContainer name="content">
                              <block class="AmritaManufacturerBlockAdminhtmlGridEdit" name="manufacturer_edit"/>
                              </referenceContainer>
                              </body>
                              </page>





                              share|improve this answer















                              You are missing layout defined in your xml file.
                              set layout="admin-2columns-left" in your page tag.



                              <?xml version="1.0"?>
                              <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                              xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" layout="admin-2columns-left">
                              <update handle="editor"/>
                              <body>
                              <referenceContainer name="content">
                              <block class="AmritaManufacturerBlockAdminhtmlGridEdit" name="manufacturer_edit"/>
                              </referenceContainer>
                              </body>
                              </page>






                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Apr 27 '17 at 5:31

























                              answered May 27 '16 at 8:37









                              Rakesh JesadiyaRakesh Jesadiya

                              30.5k1577126




                              30.5k1577126













                              • This hasn't resolved the problem. My assumption was that an admin layout would be specified by default. Also, in the example i'm following, no layout is specified. ashsmith.io/magento2/module-from-scratch-part-5-adminhtml

                                – Sophie Baxter
                                May 27 '16 at 11:04



















                              • This hasn't resolved the problem. My assumption was that an admin layout would be specified by default. Also, in the example i'm following, no layout is specified. ashsmith.io/magento2/module-from-scratch-part-5-adminhtml

                                – Sophie Baxter
                                May 27 '16 at 11:04

















                              This hasn't resolved the problem. My assumption was that an admin layout would be specified by default. Also, in the example i'm following, no layout is specified. ashsmith.io/magento2/module-from-scratch-part-5-adminhtml

                              – Sophie Baxter
                              May 27 '16 at 11:04





                              This hasn't resolved the problem. My assumption was that an admin layout would be specified by default. Also, in the example i'm following, no layout is specified. ashsmith.io/magento2/module-from-scratch-part-5-adminhtml

                              – Sophie Baxter
                              May 27 '16 at 11:04


















                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Magento Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f117226%2fcustom-admin-edit-form%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

                              How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

                              夢乃愛華...