Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block must know nothing about his parent #16

Closed
stalniy opened this issue Apr 27, 2012 · 1 comment
Closed

Block must know nothing about his parent #16

stalniy opened this issue Apr 27, 2012 · 1 comment

Comments

@stalniy
Copy link

stalniy commented Apr 27, 2012

Why? Example from life: children will never know all about his parents. So i think, you need to change Mage_Core_Block_Abstract::setParentBlock method to Mage_Core_Block_Abstract::setParentName. And rewrite Mage_Core_Block_Abstract::getParentBlock to

public function getParentBlock()
{
$layout = $this->getLayout();
if ($layout) {
return $layout->getBlock($this->_parentName);
}
}

@magento-team
Copy link
Contributor

Hi @stalniy,

currently blocks don't store information about their parents. Layout object is responsible for storing all parent-child relations.
Mage_Core_Block_Abstract::setParentBlock() method was removed.
Mage_Core_Block_Abstract::getParentBlock() refers to its layout object for the information about the parent. Probably, this method will be removed in future, when all relations to parent blocks will be eliminated.

magento-team pushed a commit that referenced this issue Jan 9, 2015
…arent-element-theme

[Extensibility] Magetwo 31776 add parent element theme
This was referenced Mar 4, 2015
@stevieyu stevieyu mentioned this issue Apr 3, 2015
magento-devops-reposync-svc pushed a commit that referenced this issue Aug 31, 2022
[Amigos] Community Contributions 2.4-develop - Patch 5
@FabXav FabXav mentioned this issue Oct 11, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants