-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Fix Inconsistency #2448
Fix Inconsistency #2448
Conversation
Fix Inconsistency between $this->buttonList->add(...) and $this->addButton(...). See /app/code/Magento/Backend/Block/Widget/Container.php public function addButton($buttonId, $data, $level = 0, $sortOrder = 0, $region = 'toolbar') { $this->buttonList->add($buttonId, $data, $level, $sortOrder, $region); return $this; }
How about also replacing We will have to wait for the travis build infrastructure to be fixed for the tests to pass. Once that happens we will be able to further process your PR. |
@Vinai ... Good catch, my main focus at the time was trying to figure out how to add a button in sales order view. See http://magento.stackexchange.com/questions/91071/how-to-add-a-custom-button-to-admin-sales-order-view-in-magento2 |
@Vinai ... After reviewing Magento\Sales\Block\Adminhtml\Order\View.php Using $this->buttonList->add/remove seem to be more consistent, because it is use 14 times while $this->addButton was only use 2 times. But if you take a look at \Magento\Backend\Block\Widget\Form\Container (extended by View ) they are using $this->addButton() And if you take a look at \Magento\Backend\Block\Widget\Container (extended by Container) this is where addButton() and removeButton() functionality was implemented. So maybe the solution here is to stop using $this->buttonList which would make this pull request irrelevant. |
Well, consistency in this case only means doing things in the same way - not which way. |
As i mention before my main focus was trying to add a button to the toolbar and notice this inconsistency without review the parent classes (and maybe we already spending too much time on this). But after reviewing all the classes, the current way to do this is $this->updateButton(), $this->removeButton(), and $this->addButton() since these are public method and $this->buttonList is protected. So the question is, do we want to make Order\View consistent, all the files consistent or just leave it alone |
Leaving code alone makes it worse :) |
Use parent method instead of protected properties
Hello @srenon, please merge latest from develop and rerun builds. |
I'm reopening this because I accidentally delete the branch |
Hi @srenon , |
@srenon Thanks for contributing! |
Fix Inconsistency between
$this->buttonList->add(...)
and$this->addButton(...)
.See
/app/code/Magento/Backend/Block/Widget/Container.php