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

GUI to Edit EAV Attributes & Sets - Base Code #2317

Draft
wants to merge 30 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ce499a9
Mage_Eav: Add generic grid code
justinbeaty Aug 3, 2022
d34bde9
Mage_Eav: Add generic form element renderers
justinbeaty Aug 3, 2022
fe41496
Merge branch main
fballiano Jul 29, 2023
80d7f81
phpcs
fballiano Jul 29, 2023
15034ca
Merge branch 'main' into topic-eav-grid
fballiano Jan 26, 2024
0293762
PHPStan
fballiano Jan 26, 2024
9dd0a4e
slightly better whitespace
fballiano Jan 26, 2024
5109615
short array format + whitespace
fballiano Jan 26, 2024
97b06aa
Merge branch 'main' into topic-eav-grid
fballiano Apr 22, 2024
b666ce6
phpcs
fballiano Apr 22, 2024
c6f1ff5
array
fballiano Apr 22, 2024
b0be74d
array
fballiano Apr 22, 2024
cdb6f8a
array
fballiano Apr 22, 2024
1bbec40
array
fballiano Apr 22, 2024
0440e6c
array
fballiano Apr 22, 2024
cb87b61
phpcs
fballiano Apr 22, 2024
558ee5d
phpcs
fballiano Apr 22, 2024
7de5ccd
phpstan
fballiano Apr 22, 2024
da9559a
type hint
fballiano Apr 22, 2024
19f41d5
Merge branch 'main' into topic-eav-grid
sreichel Sep 17, 2024
c19efe5
Merge branch 'main' into topic-eav-grid
sreichel Sep 19, 2024
ddf34c0
phpcs
sreichel Sep 19, 2024
d3e5c31
Merge branch 'main' into topic-eav-grid
sreichel Sep 19, 2024
7dd9002
Cleanup [skip ci]
sreichel Sep 19, 2024
0f8e1ec
Trigger CI
sreichel Sep 19, 2024
64fc93f
Rollback wrong copyright changes
sreichel Sep 21, 2024
b84abdb
Rollback wrong copyright changes
sreichel Sep 21, 2024
014b548
Merge branch 'main' into topic-eav-grid
sreichel Sep 23, 2024
d486ead
Rector fixes
sreichel Sep 23, 2024
87cc66c
Merge branch 'main' into topic-eav-grid
sreichel Sep 23, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Adminhtml/Block/Urlrewrite/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down Expand Up @@ -105,6 +105,6 @@ protected function _prepareColumns()
public function getRowUrl($row)
{
return $this->getUrl('*/*/edit', ['id' => $row->getId()]);
//return $this->getUrl('*/*/view', array('id' => $row->getId()));
//return $this->getUrl('*/*/view', ['id' => $row->getId()]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2020-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2020-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2019-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2019-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2018-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2018-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2019-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2019-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2017-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2017-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2020-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2020-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Api2
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2020-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2020-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Cms/Model/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Cms
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2020-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2020-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Cms/Model/Mysql4/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @category Mage
* @package Mage_Cms
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2020-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2020-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Cms/Model/Mysql4/Block/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @category Mage
* @package Mage_Cms
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2020-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2020-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Cms/Model/Mysql4/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @category Mage
* @package Mage_Cms
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2020-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2020-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Cms/Model/Mysql4/Page/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @category Mage
* @package Mage_Cms
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2020-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2020-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Cms/Model/Mysql4/Page/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @category Mage
* @package Mage_Cms
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2020-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2020-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Cms/Model/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Cms
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2019-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2019-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Cms/Model/Resource/Block/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Cms
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2019-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2019-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Cms/Model/Resource/Page/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_Cms
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2018-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2018-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @category Mage
* @package Mage_CurrencySymbol
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2020-2023 The OpenMage Contributors (https://www.openmage.org)
* @copyright Copyright (c) 2020-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
42 changes: 42 additions & 0 deletions app/code/core/Mage/Eav/Block/Adminhtml/Attribute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
/**
* OpenMage
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available at https://opensource.org/license/osl-3-0-php
*
* @category Mage
* @package Mage_Eav
* @copyright Copyright (c) 2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

declare(strict_types=1);

/**
* Adminhtml attributes block
*
* @category Mage
* @package Mage_Eav
*/
class Mage_Eav_Block_Adminhtml_Attribute extends Mage_Adminhtml_Block_Widget_Grid_Container
{
public function __construct()
{
$this->_blockGroup = 'eav';
$this->_controller = 'adminhtml_attribute';
if ($entity_type = Mage::registry('entity_type')) {
$this->_headerText = Mage::helper('eav')->__('Manage %s Attributes', Mage::helper('eav')->formatTypeCode($entity_type));
} else {
$this->_headerText = Mage::helper('eav')->__('Manage Attributes');
}
$this->_addButtonLabel = Mage::helper('eav')->__('Add New Attribute');
parent::__construct();
}

public function getHeaderCssClass(): string
{
return 'icon-head head-eav-attribute';
}
}
78 changes: 78 additions & 0 deletions app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php
/**
* OpenMage
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available at https://opensource.org/license/osl-3-0-php
*
* @category Mage
* @package Mage_Eav
* @copyright Copyright (c) 2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

declare(strict_types=1);

/**
* @category Mage
* @package Mage_Eav
*/
class Mage_Eav_Block_Adminhtml_Attribute_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
{
public function __construct()
{
$this->_objectId = 'attribute_id';
$this->_blockGroup = 'eav';
$this->_controller = 'adminhtml_attribute';

parent::__construct();

$this->_addButton(
'save_and_edit_button',
[
'label' => Mage::helper('eav')->__('Save and Continue Edit'),
'onclick' => 'saveAndContinueEdit()',
'class' => 'save'
],
100
);

$this->_updateButton('save', 'label', Mage::helper('eav')->__('Save Attribute'));
$this->_updateButton('save', 'onclick', 'saveAttribute()');

if (!Mage::registry('entity_attribute')->getIsUserDefined()) {
$this->_removeButton('delete');
} else {
$this->_updateButton('delete', 'label', Mage::helper('eav')->__('Delete Attribute'));
}
}

public function getHeaderText(): string
{
if (Mage::registry('entity_attribute')->getId()) {
$frontendLabel = Mage::registry('entity_attribute')->getFrontendLabel();
if (is_array($frontendLabel)) {
$frontendLabel = $frontendLabel[0];
}
return Mage::helper('eav')->__('Edit %s Attribute "%s"', Mage::helper('eav')->formatTypeCode(Mage::registry('entity_type')), $this->escapeHtml($frontendLabel));
} else {
return Mage::helper('eav')->__('New %s Attribute', Mage::helper('eav')->formatTypeCode(Mage::registry('entity_type')));
}
}

public function getValidationUrl(): string
{
return $this->getUrl('*/*/validate', ['_current' => true]);
}

public function getSaveUrl(): string
{
return $this->getUrl('*/*/save', ['_current' => true, 'back' => null]);
}

public function getHeaderCssClass(): string
{
return 'icon-head head-eav-attribute';
}
}
35 changes: 35 additions & 0 deletions app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Form.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* OpenMage
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available at https://opensource.org/license/osl-3-0-php
*
* @category Mage
* @package Mage_Eav
* @copyright Copyright (c) 2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

declare(strict_types=1);

/**
* @category Mage
* @package Mage_Eav
*/
class Mage_Eav_Block_Adminhtml_Attribute_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
{
protected function _prepareForm()
{
$form = new Varien_Data_Form([
'id' => 'edit_form',
'action' => $this->getData('action'),
'method' => 'post'
]);
$form->setUseContainer(true);
$this->setForm($form);

return parent::_prepareForm();
}
}
Loading
Loading