Unified creating of common blocks
This prevents calling methods on non existing blocks.
- added some helper methods for common block (rout, head, breadcrumbs)
- deprecated
get Block()in favor ofgetBlockByName()that returnsnullor existing block, allowing to use PHP´8 null safe operator
I dislike that the new functions still returns false on missing block.
(that functions can return false instead of null is something I dislike about old magento core)
If they returned null instead, then you could use ?-> the Null-Safe Operator
$this->getLayout()->getBlockAdminhtmlHead()?->setCanLoadTinyMce(true);
I'm with copilot there: Breaking the method chain reduces readability
Okay, change it.
i don't know why getDefaultTitle is needed when both title_prefix and title_suffix exist
🤷♂️
but that might be a different issue
You are right. "Reference in new issue" and move on?
@kiatng set it on draft again.
There are much more blocks that coud be loaded that way, but this would make Mage_Core_Model_Layout bigger and bigger.
How about adding traits for that?
