Skip to content

Commit ca8ded6

Browse files
committed
Fetch component by blockId via Alpine.store('components').getComponentByBlockId()
1 parent 95b688f commit ca8ded6

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

view/base/templates/script/components-store.phtml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ use Magento\Framework\View\Element\Template;
4343
return component.elementId === elementId;
4444
});
4545
},
46+
getComponentByBlockId(blockId) {
47+
return this.getComponentArray().find((component) => {
48+
return component.blockId === blockId;
49+
});
50+
},
4651
exists(component) {
4752
return document.getElementById(component.elementId);
4853
},

0 commit comments

Comments
 (0)