You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem I'm encountering ATM is an entry is not erroring when it has the same identifier field as another entry in the same collection. #2829
As a potential workaround to this problem I see there exists the ability to "hook" into prepublish events with CMS.registerEventListener.
What I'd like to try is on pre-publish, fetch for all the identifier values in the same collection and match that against the currently published entry's identifier value. If there exists a match, somehow throw an error and prevent the publish.
But to do this - I need to know:
the identifier value of the entry
the identifier values of all entries in the same collection
Are there any API's that CMS exposes that can allow me to get this info?
Is there an API that allows me to throw toast notification errors similar to what field validation errors throw?
The text was updated successfully, but these errors were encountered:
vai0
changed the title
API exposing entry data and collection data
API exposing entry and collection data
Feb 12, 2020
HI @vai0,
since netlify CMS does not has its own persistancy you can use the API of the repository where the data is stored (e.g. GitHub). OR you get the API through other tools you maybe use anyways for buildign your website - e.g. gridsome, which loads the netlfiy CMS data (by parsing the files) and exposes a GraphQL to browse the data.
EDIT: Gridsome might not be a good idea for this use case because it would have to rebuild after every push of new content in order to have up-to-date data in the graph.
The problem I'm encountering ATM is an entry is not erroring when it has the same identifier field as another entry in the same collection. #2829
As a potential workaround to this problem I see there exists the ability to "hook" into prepublish events with
CMS.registerEventListener
.What I'd like to try is on pre-publish, fetch for all the identifier values in the same collection and match that against the currently published entry's identifier value. If there exists a match, somehow throw an error and prevent the publish.
But to do this - I need to know:
The text was updated successfully, but these errors were encountered: