0

Main question is:
What is the layout file for

\Magento\Sales\Controller\Adminhtml\Order\Create\LoadBlock

controller?

Here is some background why I needed that:
I am making custom module that will have similar functionality as Magento_Sales modules (pages where admin can create new order). I've copied all needed files form Magento_Sales module, and at the end I can't figure out what is layout for

\Magento\Sales\Controller\Adminhtml\Order\Create\LoadBlock

As you can see on github Link there is no layout file sales_order_create_loadblock.xml

In LoadBlock execute method
Link
there is some code for adding handle

foreach ($blocks as $block) {
  $resultPage->addHandle('sales_order_create_load_block_' . $block);
}

for each block, but I can't find where the main layout file is included.

1 Answer 1

0

I've walked via xdebug and figured out the basic layout functionality for this.

There is two layout handlers for this controller: default and sales_order_create_loadblock

When a result page is created

/** @var \Magento\Framework\View\Result\Page $resultPage */
$resultPage = $this->resultPageFactory->create();

only these two handlers are added. After that, for each block another handler is added, but that is obviously from the controller's code.

According to Magento's documentation if file

sales_order_create_loadblock.xml

doesn't exist, the controller will use

default.xml

(in this case file from admin theme,

/vendor/magento/theme-adminhtml-backend/Magento_Backend/layout/default.xml)

merged will all others default.xml files from active modules and themes).

So, the answer is not so simple for me, but now I understand how layout system works

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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