Hello,
I tried to extend a component in the administration, like explained on this page: https://docs.shopware.com/en/shopware-platform-dev-en/developer-guide/administration/inheritance
I want to add an extra menu option in the sidebar list on the Content -> Shopping Experiences page. So I created a plugin with the cli. In /src/Resources/app/administration/src/main I created the following code:
const { Component } = Shopware;
Component.extend('sw-cms-list', {
computed: {
sortPageTypes() {
return [
{ value: '', name: this.$tc('sw-cms.sorting.labelSortByAllPages'), active: true },
{ value: 'page', name: this.$tc('sw-cms.sorting.labelSortByShopPages') },
{ value: 'landingpage', name: this.$tc('sw-cms.sorting.labelSortByLandingPages') },
{ value: 'product_list', name: this.$tc('sw-cms.sorting.labelSortByCategoryPages') },
{ value: 'custom_form', name: 'Custom form' }
];
}
}
});
My console shows an error: Uncaught TypeError: Cannot read property ‘template’ of undefined
at Object.extend (commons.js?1588970146199238:1)
at Object.0ZX1 (custom-forms.js?1588970147777:1)
So, what is exactly wrong with my extend? Why do I need to define a template since I only want to overwrite one function from computed?