How can I extend sw-context-menu-item
and use a custom config action route?
If i override sw-context-menu-item
and there is another plugin that does that , it wont work.
Also tried to extend it with this but with no luck:
Component.extend('my-custom-extension', 'sw-context-menu-item', {
`<template>
<sw-context-menu-item
:icon="icon"
:label="label"
:disabled="disabled"
:routerLink="routerLink"
@click="onClick"
class="sw-context-menu-item"
/>
</template>`
});
Is there another way to change the plugin config to point to another route?
Overriding the original component, you could alter the routerLink
object on creation.
Component.override('sw-context-menu-item', {
created() {
if (!this.routerLink || this.routerLink.name !== 'route.to.replace') {
return;
}
this.routerLink.name = 'new.route';
this.routerLink.params = {};
},
});