Open
Description
Hi, it would be nice if we can override the Menu Item layout because sometime user want some fields at the top or change (placeholder, description) of the original field such as target
or url
.
Currently it will add duplicate fields like in the code below. I think we can do filter unique field on function getFieldsLayout
.
// ./src/extensions/menus/strapi-server.js`
'use strict';
module.exports = plugin => {
// Get current `MenuItem` attributes.
const defaultAttrs = plugin.contentTypes['menu-item'].schema.attributes;
// Define custom attributes for `MenuItem` the same way they would be defined
// on any other schema.
const customAttrs = {
zhTitle: {
type: 'string',
},
isHide: {
type: 'boolean',
},
};
// Extend the `MenuItem` content type with custom attributes.
plugin.contentTypes['menu-item'].schema.attributes = {
...defaultAttrs,
...customAttrs,
};
return plugin;
};
// ./config/plugins.ts
export default ({ env }) => ({
menus: {
config: {
maxDepth: 3,
layouts: {
menuItem: {
link: [
{
input: {
label: 'Hide Menu',
name: 'isHide',
type: 'bool'
},
grid: { col: 6 }
},
{
input: {
label: 'Title (Chinese)',
name: 'zhTitle',
type: 'text',
placeholder: 'Write title here...'
},
grid: { col: 6 }
},
{
input: {
label: 'How does it open?',
name: 'target', // <== I want to override the default target field
type: 'select',
options: [
{ label: 'New Window', value: '_blank' },
{ label: 'Current Window', value: '_top' }
]
},
grid: { col: 6 }
}
]
}
}
}
}
});
Metadata
Metadata
Assignees
Labels
No labels