mattmilburn / strapi-plugin-menus

A plugin for Strapi CMS to customize the structure of menus and menu items.
MIT License
112 stars 28 forks source link

Item of schema type 'media' are not returning through api #76

Closed johncorlett-ultracommerce closed 1 year ago

johncorlett-ultracommerce commented 1 year ago

./src/extensions/menus/strapi-server.js contains schema:

const customAttrs = { menuItemIcon: { type: 'media', allowedTypes: [ 'images' ], multiple: false, }, menuItemThumbnail: { type: 'media', allowedTypes: [ 'images' ], multiple: false, }, menuItemFeatureImage: { type: 'media', allowedTypes: [ 'images' ], multiple: false, }, };

http://localhost:1337/api/menus/3?populate=* returns:

"items": [ { "id": 17, "order": 0, "title": "Profiles", "url": "/products", "target": null, "createdAt": "2022-12-28T22:01:41.002Z", "updatedAt": "2022-12-29T22:42:09.712Z" },

Changing type to string allows the custom item to appear in the api as a null.

mortenwibrand commented 1 year ago

I had the same problem. Solved it by using this plugin: https://github.com/Barelydead/strapi-plugin-populate-deep

In my case with a menu in three levels, I used /menus/1?nested=true&populate=deep,3