Extend properties within a module, instead of overwriting the whole property

Hey party people - Quick question:
If I override a component: Is there a way to really extend a method or properties instead of overwriting the whole property or method to keep the core data?

For example, i want to override component XY which has some computed properties:

computed: {
        fooBar() {
            return [
                { value: 'foo' },
                { value: 'foo' }
            ];
        },
...

Now instead of overriding the whole property fooBar, I just want to extend it / push the new value to it to keep the core values and not override them.
I would do it with something like

corevalues.push('...');

But I am wondering how would I get the core values from the parent component? :slight_smile:

If I am looking at the vue docs, this would be done with mixins: https://vuejs.org/v2/guide/mixins.html#Option-Merging
But the core component within Shopware doesn’t use those mixins for the values as far as i see. So is there a “Shopware way” to merge those values within administration components/modules?

1 „Gefällt mir“

Did you find a solution?

1 „Gefällt mir“

@Shopwareianer

Did someone found a solution?

EDIT: probably like this:
https://developer.shopware.com/docs/guides/plugins/plugins/administration/add-rule-assignment-configuration

There is at least a property merger out there very useful. Unfortunatley it is missing option merge, but you may want to extend it yourself. Workaround could be to put the „to merge options“ in a fake group and then perform the group merge, before that - cleaning spaces, or other inconsistent data so it will merge /override.