Skip to content

Commit

Permalink
Added comments and some descriptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagosampaio authored and mage2pratik committed Jul 18, 2018
1 parent fb93d25 commit ff94075
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions app/code/Magento/Backend/Block/Widget/Tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ protected function _beforeToHtml()
$this->_tabs = $this->reorderTabs();

if ($this->_activeTab === null) {
/** @var $tab */
foreach ($this->_tabs as $tab) {
$this->_activeTab = $tab->getId();
break;
Expand Down Expand Up @@ -263,8 +264,10 @@ protected function reorderTabs()
$position = 100;

/**
* @var string $key
* @var \Magento\Backend\Block\Widget\Tab\TabInterface $tab
* Set the initial positions for each tab.
*
* @var string $key
* @var TabInterface $tab
*/
foreach ($this->_tabs as $key => $tab) {
$tab->setPosition($position);
Expand All @@ -277,6 +280,12 @@ protected function reorderTabs()

$positionFactor = 1;

/**
* Rearrange the positions by using the after tag for each tab.
*
* @var integer $position
* @var TabInterface $tab
*/
foreach ($orderByPosition as $position => $tab) {
if (!$tab->getAfter() || !in_array($tab->getAfter(), array_keys($orderByIdentity))) {
$positionFactor = 1;
Expand Down

0 comments on commit ff94075

Please sign in to comment.