Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
joshine
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
joshine
Commits
c11e36a2
Commit
c11e36a2
authored
Feb 08, 2023
by
halweg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: custom menu group
parent
f67f2b9f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
2 deletions
+67
-2
app/code/Joshine/Category/Setup/InstallData.php
+7
-1
app/code/Joshine/Category/Setup/UpgradeData.php
+55
-0
app/code/Joshine/Category/view/adminhtml/ui_component/category_form.xml
+5
-1
No files found.
app/code/Joshine/Category/Setup/InstallData.php
View file @
c11e36a2
...
...
@@ -21,6 +21,12 @@ class InstallData implements InstallDataInterface
)
{
$eavSetup
=
$this
->
eavSetupFactory
->
create
([
'setup'
=>
$setup
]);
$eavSetup
->
addAttributeGroup
(
\Magento\Catalog\Model\Category
::
ENTITY
,
$eavSetup
->
getDefaultAttributeSetId
(
\Magento\Catalog\Model\Category
::
ENTITY
),
'Custom Menu'
,
99
);
$eavSetup
->
addAttribute
(
\Magento\Catalog\Model\Category
::
ENTITY
,
'badge'
,
...
...
@@ -35,7 +41,7 @@ class InstallData implements InstallDataInterface
'required'
=>
false
,
'user_defined'
=>
false
,
'default'
=>
null
,
'group'
=>
''
,
'group'
=>
'
Custom Menu
'
,
'backend'
=>
''
]
);
...
...
app/code/Joshine/Category/Setup/UpgradeData.php
0 → 100644
View file @
c11e36a2
<?php
namespace
Joshine\Category\Setup
;
use
Magento\Framework\Module\Setup\Migration
;
use
Magento\Framework\Setup\UpgradeDataInterface
;
use
Magento\Framework\Setup\ModuleContextInterface
;
use
Magento\Framework\Setup\ModuleDataSetupInterface
;
use
Magento\Catalog\Setup\CategorySetupFactory
;
/**
* Data migration:
* - Config Migration from version 2.0.1 JSON file store to 2.0.2+ Magento config way
*
*/
class
UpgradeData
implements
UpgradeDataInterface
{
private
$categorySetupFactory
;
public
function
__construct
(
CategorySetupFactory
$categorySetupFactory
)
{
$this
->
categorySetupFactory
=
$categorySetupFactory
;
}
/**
* Run data upgrade.
*
* @param ModuleDataSetupInterface $setup
* @param ModuleContextInterface $context
*/
public
function
upgrade
(
ModuleDataSetupInterface
$setup
,
ModuleContextInterface
$context
)
{
$setup
->
startSetup
();
if
(
version_compare
(
$context
->
getVersion
(),
'1.0.1'
)
<
0
)
{
$categorySetup
=
$this
->
categorySetupFactory
->
create
([
'setup'
=>
$setup
]);
$entityTypeId
=
$categorySetup
->
getEntityTypeId
(
\Magento\Catalog\Model\Category
::
ENTITY
);
$attributeSetId
=
$categorySetup
->
getDefaultAttributeSetId
(
$entityTypeId
);
$idg
=
$categorySetup
->
getAttributeGroupId
(
$entityTypeId
,
$attributeSetId
,
'Custom Menu'
);
$categorySetup
->
addAttributeToGroup
(
$entityTypeId
,
$attributeSetId
,
$idg
,
'badge'
,
1
);
}
$setup
->
endSetup
();
}
}
app/code/Joshine/Category/view/adminhtml/ui_component/category_form.xml
View file @
c11e36a2
<?xml version="1.0" ?>
<form
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"
>
<fieldset
name=
"display_settings"
>
<fieldset
name=
"custom_menu"
>
<settings>
<collapsible>
true
</collapsible>
<label
translate=
"false"
>
Custom Menu
</label>
</settings>
<field
name=
"badge"
sortOrder=
"300"
>
<argument
name=
"data"
xsi:type=
"array"
>
<item
name=
"options"
xsi:type=
"object"
>
Joshine\Category\Model\Category\Attribute\Source\Badge
</item>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment