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
0b9ddc93
Commit
0b9ddc93
authored
May 11, 2023
by
halweg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
menu间距宽度自定义字段
parent
65ab988b
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
113 additions
and
6 deletions
+113
-6
app/code/Joshine/Category/Block/Html/Topmenu.php
+14
-2
app/code/Joshine/Category/Model/Category/Attribute/Source/Columns.php
+1
-0
app/code/Joshine/Category/Plugin/Block/Topmenu.php
+6
-0
app/code/Joshine/Category/Setup/UpgradeData.php
+42
-0
app/code/Joshine/Category/etc/module.xml
+1
-1
app/code/Joshine/Category/view/adminhtml/ui_component/category_form.xml
+49
-3
No files found.
app/code/Joshine/Category/Block/Html/Topmenu.php
View file @
0b9ddc93
...
...
@@ -205,9 +205,13 @@ class Topmenu extends JoshineMenu
$columns
=
"11"
;
}
if
(
$childLevel
==
0
)
{
$leftMargin
=
$child
->
getChildLeftMargin
();
if
(
$leftMargin
!=
"0"
&&
empty
(
$leftMargin
))
{
$leftMargin
=
"1"
;
}
$html
=
"<div class=
\"
level
{
$childLevel
}
{
$childrenWrapClass
}
\"
>"
;
$html
.=
"<div class=
\"
row
\"
>
<ul class=
\"
subchildmenu joshine-col-lg-push-
1
mega-columns joshine-clearfix joshine-col-lg-
{
$columns
}
{
$child
->
getMenuImage
()
}
\"
>
<ul class=
\"
subchildmenu joshine-col-lg-push-
{
$leftMargin
}
mega-columns joshine-clearfix joshine-col-lg-
{
$columns
}
{
$child
->
getMenuImage
()
}
\"
>
{
$this
->
_getHtml
(
$child
,
$childrenWrapClass
,
$limit
,
$colStops
)
}
</ul>"
;
$html
.=
$this
->
appendImage
(
$child
);
...
...
@@ -228,7 +232,15 @@ class Topmenu extends JoshineMenu
}
if
(
$child
->
getMenuImage
())
{
$html
.=
"<div class=
\"
pull-right joshine-col-lg-3 joshine-col-lg-push-1 joshine-hidden-xs joshine-hidden-sm joshine-hidden-md
\"
>"
;
$imageLeftMargin
=
$child
->
getImageLeftMargin
();
if
(
empty
(
$imageLeftMargin
))
{
$imageLeftMargin
=
"0"
;
}
$imageWidth
=
$child
->
getImageWidth
();
if
(
empty
(
$imageWidth
))
{
$imageWidth
=
"3"
;
}
$html
.=
"<div class=
\"
pull-right joshine-col-lg-
{
$imageWidth
}
joshine-col-lg-push-
{
$imageLeftMargin
}
joshine-hidden-xs joshine-hidden-sm joshine-hidden-md
\"
>"
;
$html
.=
"<img src='
{
$child
->
getMenuImage
()
}
'/>"
;
$html
.=
"</div>"
;
}
...
...
app/code/Joshine/Category/Model/Category/Attribute/Source/Columns.php
View file @
0b9ddc93
...
...
@@ -27,6 +27,7 @@ class Columns extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
if
(
!
$this
->
_optionsData
)
{
$this
->
_optionsData
=
[
[
'value'
=>
''
,
'label'
=>
'----'
],
[
'value'
=>
'0'
,
'label'
=>
'0-columns'
],
[
'value'
=>
'1'
,
'label'
=>
'1-columns'
],
[
'value'
=>
'2'
,
'label'
=>
'2-columns'
],
[
'value'
=>
'3'
,
'label'
=>
'3-columns'
],
...
...
app/code/Joshine/Category/Plugin/Block/Topmenu.php
View file @
0b9ddc93
...
...
@@ -147,6 +147,9 @@ class Topmenu extends Menu
'badge'
=>
$category
->
getData
(
'badge'
),
'submenu_columns_total'
=>
$category
->
getData
(
'submenu_columns_total'
),
'self_columns'
=>
$category
->
getData
(
'self_columns'
),
'image_left_margin'
=>
$category
->
getData
(
'image_left_margin'
),
'image_width'
=>
$category
->
getData
(
'image_width'
),
'child_left_margin'
=>
$category
->
getData
(
'child_left_margin'
),
'submenu_columns_single'
=>
$category
->
getData
(
'submenu_columns_single'
),
'menu_image'
=>
$category
->
getData
(
'menu_image'
),
'has_active'
=>
in_array
((
string
)
$categoryId
,
explode
(
'/'
,
(
string
)
$currentCategory
->
getPath
()),
true
),
...
...
@@ -176,6 +179,9 @@ class Topmenu extends Menu
$collection
->
addAttributeToSelect
(
'submenu_columns_total'
);
$collection
->
addAttributeToSelect
(
'submenu_columns_single'
);
$collection
->
addAttributeToSelect
(
'self_columns'
);
$collection
->
addAttributeToSelect
(
'image_left_margin'
);
$collection
->
addAttributeToSelect
(
'image_width'
);
$collection
->
addAttributeToSelect
(
'child_left_margin'
);
$collection
->
addAttributeToSelect
(
'menu_image'
);
$collection
->
addFieldToFilter
(
'path'
,
[
'like'
=>
'1/'
.
$rootId
.
'/%'
]);
//load only from store root
$collection
->
addAttributeToFilter
(
'include_in_menu'
,
1
);
...
...
app/code/Joshine/Category/Setup/UpgradeData.php
View file @
0b9ddc93
...
...
@@ -146,6 +146,48 @@ class UpgradeData implements UpgradeDataInterface
'required'
=>
false
,
'sort_order'
=>
100
,
'global'
=>
\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface
::
SCOPE_STORE
,
],
'image_left_margin'
=>
[
'type'
=>
'varchar'
,
'label'
=>
'image_left_margin'
,
'input'
=>
'select'
,
'sort_order'
=>
101
,
'source'
=>
'\Joshine\Category\Model\Category\Attribute\Source\Columns'
,
'global'
=>
\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface
::
SCOPE_STORE
,
'visible_on_front'
=>
true
,
'required'
=>
false
,
'user_defined'
=>
false
,
'default'
=>
null
,
'group'
=>
'image_left_margin'
,
'backend'
=>
''
],
'image_width'
=>
[
'type'
=>
'varchar'
,
'label'
=>
'image_width'
,
'input'
=>
'select'
,
'sort_order'
=>
101
,
'source'
=>
'\Joshine\Category\Model\Category\Attribute\Source\Columns'
,
'global'
=>
\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface
::
SCOPE_STORE
,
'visible_on_front'
=>
true
,
'required'
=>
false
,
'user_defined'
=>
false
,
'default'
=>
null
,
'group'
=>
'image_width'
,
'backend'
=>
''
],
'child_left_margin'
=>
[
'type'
=>
'varchar'
,
'label'
=>
'child_left_margin'
,
'input'
=>
'select'
,
'sort_order'
=>
101
,
'source'
=>
'\Joshine\Category\Model\Category\Attribute\Source\Columns'
,
'global'
=>
\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface
::
SCOPE_STORE
,
'visible_on_front'
=>
true
,
'required'
=>
false
,
'user_defined'
=>
false
,
'default'
=>
null
,
'group'
=>
'child_left_margin'
,
'backend'
=>
''
]
];
...
...
app/code/Joshine/Category/etc/module.xml
View file @
0b9ddc93
...
...
@@ -6,5 +6,5 @@
*/
-->
<config
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"urn:magento:framework:Module/etc/module.xsd"
>
<module
name=
"Joshine_Category"
setup_version=
"1.1.
7
"
/>
<module
name=
"Joshine_Category"
setup_version=
"1.1.
8
"
/>
</config>
app/code/Joshine/Category/view/adminhtml/ui_component/category_form.xml
View file @
0b9ddc93
...
...
@@ -39,6 +39,52 @@
</argument>
</field>
<field
name=
"child_left_margin"
sortOrder=
"300"
>
<argument
name=
"data"
xsi:type=
"array"
>
<item
name=
"options"
xsi:type=
"object"
>
Joshine\Category\Model\Category\Attribute\Source\Columns
</item>
<item
name=
"config"
xsi:type=
"array"
>
<item
name=
"required"
xsi:type=
"boolean"
>
false
</item>
<item
name=
"validation"
xsi:type=
"array"
>
<item
name=
"required-entry"
xsi:type=
"boolean"
>
false
</item>
</item>
<item
name=
"dataType"
xsi:type=
"string"
>
string
</item>
<item
name=
"formElement"
xsi:type=
"string"
>
select
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
Child left Margin(子类块左间距)
</item>
</item>
</argument>
</field>
<field
name=
"image_left_margin"
sortOrder=
"300"
>
<argument
name=
"data"
xsi:type=
"array"
>
<item
name=
"options"
xsi:type=
"object"
>
Joshine\Category\Model\Category\Attribute\Source\Columns
</item>
<item
name=
"config"
xsi:type=
"array"
>
<item
name=
"required"
xsi:type=
"boolean"
>
false
</item>
<item
name=
"validation"
xsi:type=
"array"
>
<item
name=
"required-entry"
xsi:type=
"boolean"
>
false
</item>
</item>
<item
name=
"dataType"
xsi:type=
"string"
>
string
</item>
<item
name=
"formElement"
xsi:type=
"string"
>
select
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
image left margin(图片左间距)
</item>
</item>
</argument>
</field>
<field
name=
"image_width"
sortOrder=
"300"
>
<argument
name=
"data"
xsi:type=
"array"
>
<item
name=
"options"
xsi:type=
"object"
>
Joshine\Category\Model\Category\Attribute\Source\Columns
</item>
<item
name=
"config"
xsi:type=
"array"
>
<item
name=
"required"
xsi:type=
"boolean"
>
false
</item>
<item
name=
"validation"
xsi:type=
"array"
>
<item
name=
"required-entry"
xsi:type=
"boolean"
>
false
</item>
</item>
<item
name=
"dataType"
xsi:type=
"string"
>
string
</item>
<item
name=
"formElement"
xsi:type=
"string"
>
select
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
image width(图片宽度)
</item>
</item>
</argument>
</field>
<field
name=
"submenu_columns_total"
sortOrder=
"300"
>
<argument
name=
"data"
xsi:type=
"array"
>
<item
name=
"options"
xsi:type=
"object"
>
Joshine\Category\Model\Category\Attribute\Source\Columns
</item>
...
...
@@ -49,7 +95,7 @@
</item>
<item
name=
"dataType"
xsi:type=
"string"
>
string
</item>
<item
name=
"formElement"
xsi:type=
"string"
>
select
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
Submenu Columns Total
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
Submenu Columns Total
(子类块总宽度)
</item>
</item>
</argument>
</field>
...
...
@@ -64,7 +110,7 @@
</item>
<item
name=
"dataType"
xsi:type=
"string"
>
string
</item>
<item
name=
"formElement"
xsi:type=
"string"
>
select
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
Self Columns
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
Self Columns
(自身宽度)
</item>
</item>
</argument>
</field>
...
...
@@ -79,7 +125,7 @@
</item>
<item
name=
"dataType"
xsi:type=
"string"
>
string
</item>
<item
name=
"formElement"
xsi:type=
"string"
>
select
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
Submenu Columns Single(
will overwrite by Self Columns
)
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
Submenu Columns Single(
子类自身宽度批量设置,如子类自身设置宽度,会被覆盖
)
</item>
</item>
</argument>
</field>
...
...
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