Skip to content

Commit 367041a

Browse files
committed
#511: Content Snapshot on Product Page in Admin Panel
- Extending Plugin w/ Minor Refactoring - Adding KO Template
1 parent 254a1f7 commit 367041a

File tree

2 files changed

+64
-3
lines changed
  • app/code/Magento/PageBuilder
    • Plugin/Catalog/Ui/DataProvider/Product/Form/Modifier
    • view/adminhtml/web/template/form/components/group

2 files changed

+64
-3
lines changed

app/code/Magento/PageBuilder/Plugin/Catalog/Ui/DataProvider/Product/Form/Modifier/EavPlugin.php

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
class EavPlugin
1818
{
19+
const META_ATTRIBUTE_CONFIG_PATH = 'arguments/data/config';
20+
1921
/**
2022
* @var ArrayManager
2123
*/
@@ -45,12 +47,11 @@ public function afterSetupAttributeMeta(
4547
$sortOrder
4648
)
4749
{
48-
$attributeCode = $attribute->getAttributeCode();
4950
$meta = $result;
5051

51-
if ($attributeCode === 'description') {
52+
if ($attribute->getData('is_pagebuilder_enabled')) {
5253
$meta = $this->arrayManager->merge(
53-
'arguments/data/config',
54+
static::META_ATTRIBUTE_CONFIG_PATH,
5455
$result,
5556
[
5657
'additionalClasses' => 'admin__field-wide admin__field-page-builder'
@@ -60,4 +61,31 @@ public function afterSetupAttributeMeta(
6061

6162
return $meta;
6263
}
64+
65+
/**
66+
* @param EavModifier $subject
67+
* @param array $result
68+
* @param ProductAttributeInterface $attribute
69+
* @return array
70+
*/
71+
public function afterSetupAttributeContainerMeta(EavModifier $subject, $result, ProductAttributeInterface $attribute)
72+
{
73+
$containerMeta = $result;
74+
75+
if ($attribute->getData('is_pagebuilder_enabled')) {
76+
$containerMeta = $this->arrayManager->merge(
77+
static::META_ATTRIBUTE_CONFIG_PATH,
78+
$result,
79+
[
80+
'additionalFieldsetClasses' => [
81+
'admin__field-wide' => true,
82+
'admin__field-page-builder' => true
83+
],
84+
'template' => 'Magento_PageBuilder/form/components/group/group'
85+
]
86+
);
87+
}
88+
89+
return $containerMeta;
90+
}
6391
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!--
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<fieldset class="admin__field"
8+
visible="visible"
9+
css="Object.assign({_required: required}, $data.additionalFieldsetClasses)"
10+
attr="'data-index': index">
11+
<legend class="admin__field-label" if="showLabel">
12+
<span translate="label" attr="'data-config-scope': $data.scopeLabel"/>
13+
</legend>
14+
15+
<div class="admin__field-control" css="$data.additionalClasses">
16+
<each args="elems">
17+
<if args="visible()" if="!$data.additionalForGroup">
18+
<render args="$parent.fieldTemplate" if="element.input_type != 'checkbox' || element.input_type != 'radio'"/>
19+
<render args="elementTmpl" if="element.input_type == 'checkbox' || element.input_type == 'radio'"/>
20+
</if>
21+
</each>
22+
23+
<each args="getRegion('insideGroup')" render=""/>
24+
25+
<each args="elems" if="validateWholeGroup">
26+
<if args="!$data.additionalForGroup">
27+
<label class="admin__field-error" if="error() && visible()" attr="for: uid" text="error"/>
28+
</if>
29+
</each>
30+
</div>
31+
32+
<each args="getRegion('outsideGroup')" render=""/>
33+
</fieldset>

0 commit comments

Comments
 (0)