Skip to content

Fix wrong position of button list when load "New Attribute" page #27574

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public function __construct(
}

/**
* Construct block
*
* @return void
*/
protected function _construct()
Expand All @@ -51,6 +53,14 @@ protected function _construct()

parent::_construct();

$this->buttonList->update('save', 'label', __('Save Attribute'));
$this->buttonList->update('save', 'class', 'save primary');
$this->buttonList->update(
'save',
'data_attribute',
['mage-init' => ['button' => ['event' => 'save', 'target' => '#edit_form']]]
);

if ($this->getRequest()->getParam('popup')) {
$this->buttonList->remove('back');
if ($this->getRequest()->getParam('product_tab') != 'variations') {
Expand All @@ -64,6 +74,8 @@ protected function _construct()
100
);
}
$this->buttonList->update('reset', 'level', 10);
$this->buttonList->update('save', 'class', 'save action-secondary');
} else {
$this->addButton(
'save_and_edit_button',
Expand All @@ -79,14 +91,6 @@ protected function _construct()
);
}

$this->buttonList->update('save', 'label', __('Save Attribute'));
$this->buttonList->update('save', 'class', 'save primary');
$this->buttonList->update(
'save',
'data_attribute',
['mage-init' => ['button' => ['event' => 'save', 'target' => '#edit_form']]]
);

$entityAttribute = $this->_coreRegistry->registry('entity_attribute');
if (!$entityAttribute || !$entityAttribute->getIsUserDefined()) {
$this->buttonList->remove('delete');
Expand All @@ -96,14 +100,14 @@ protected function _construct()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function addButton($buttonId, $data, $level = 0, $sortOrder = 0, $region = 'toolbar')
{
if ($this->getRequest()->getParam('popup')) {
$region = 'header';
}
parent::addButton($buttonId, $data, $level, $sortOrder, $region);
return parent::addButton($buttonId, $data, $level, $sortOrder, $region);
}

/**
Expand Down