Skip to content

Commit

Permalink
feat: check if attribute has scope global + style: store btn input with
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreBulete committed Nov 9, 2024
1 parent d2c609e commit cc8d3b5
Show file tree
Hide file tree
Showing 5 changed files with 157,880 additions and 32 deletions.
5 changes: 4 additions & 1 deletion Plugin/ProductEavDataProviderPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ public function afterSetupAttributeMeta(Eav $subject, array $result): array
$adminStoreViewId = \Magento\Store\Model\Store::DEFAULT_STORE_ID;
$currentStoreViewId = $this->storeManager->getStore()->getId();

if ((int) $currentStoreViewId === (int) $adminStoreViewId) {
if ($result['arguments']['data']['config']['globalScope']) {
return $result;
}
if ((int) $currentStoreViewId === (int) $adminStoreViewId && $result['arguments']['data']['config']['globalScope'] == false) {
$result['arguments']['data']['config']['storebtn'] = '<button class=\'btn-store-view\' data-attribute-code=\'' . $attributeCode . '\'>' . $storeSvg . '</button>';
}

Expand Down
16 changes: 11 additions & 5 deletions view/adminhtml/web/css/app.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
div.store-view-container {
div.admin__field-control._with-store_btn input, div.admin__field-control._with-store_btn select {
width: calc(100% - 59px);
}
div.admin__field-control._with-store_btn._with-tooltip input, div.admin__field-control._with-store_btn._with-tooltip select {
width: calc(100% - 89px);
}
div.admin__field-control div.store-view-container {
display: inline-block;
padding-left: 20px;
}
div.store-view-container .btn-store-view {
div.admin__field-control div.store-view-container .btn-store-view {
background-color: #000000;
padding: 10px;
display: inline-block;
Expand All @@ -14,14 +20,14 @@ div.store-view-container .btn-store-view {
align-items: center;
justify-content: center;
}
div.store-view-container .btn-store-view:hover {
div.admin__field-control div.store-view-container .btn-store-view:hover {
background-color: #ffffff;
border-color: #000000;
}
div.store-view-container .btn-store-view:hover svg {
div.admin__field-control div.store-view-container .btn-store-view:hover svg {
color: #000000;
}
div.store-view-container .btn-store-view svg {
div.admin__field-control div.store-view-container .btn-store-view svg {
color: #ffffff;
width: 100%;
height: 100%;
Expand Down
Loading

0 comments on commit cc8d3b5

Please sign in to comment.