We’ve improved the editor experience by adding selection in the collection list view and new controls to Edit, Delete, and if drafts are enabled, Publish, and Unpublish. We also added API endpoints to handle the changes and also extended the local API for programmatic access. The new features are available in v1.6.24 and later.
The workflow for these are all much the same, select a bunch of documents and go for it. You’ll get a prompt to make sure you are happy with your life choices before submitting. The changes are all handled in one request. After submitting, the UI shows the number of updated documents. If there are any errors that occur due to validation or any faults in a hook on the backend, the number of documents that didn’t get updated due to error is also shown. The results are more detailed in the HTTP response or local API for your apps to deal with.
The editing experience for multiple documents in a collection allows the editor to choose which fields to update. You can access all fields within a nested structure with the field selector and input your changes before saving. Fields that are hidden, unique or read-only are not available, and you can also configure the admin.disableBulkEdit
option to remove certain fields.
When drafts are enabled for a collection, you also have the choice to publish or save as draft. That gives you three ways to submit:
Instead of selecting individual rows in the list, an editor can select all documents in the list. The select-all option can be used with the existing search and filter options to only include all documents matching certain criteria. With this, the bulk edit, publish, unpublish and delete workflows will use the query to perform the operation against all the matching items.
The new functionality extends to the backend and local API as well.
There are new REST endpoints for collections to allow for bulk delete and updates:
PATCH /api/pages
DELETE /api/pages
Each endpoint takes a query in the same form as a GET
request would to make our changes against.
The local APIs have also been extended to take either an id
or where
query.
Update your own Payload project or head on over to the public demo at demo.payloadcms.com and give it a shot.