Cms: [3.2] Make export button optional

Created on 4 Jul 2019  Â·  3Comments  Â·  Source: craftcms/cms

It seems like the new element export feature currently doesn’t export data for relationship fields (including Matrix) which can make the feature a bit useless for some elements, at least from the client point of view.

I’m suggesting to make the feature optional, possibly via permissions. Configuration for every entry section, category type, etc. is probably a bit too much.

enhancement user management

Most helpful comment

It would be especially helpful in the weeks until export becomes useful for all content.

But in general I feel like export and import is a feature you don’t really want to expose to all of your users.

All 3 comments

We do plan on adding a new JSON output format that would include relation info, and a built-in importer that can work with the exported JSON. Once that’s in place, I’m curious if you’d still care to disable exporting?

It would be especially helpful in the weeks until export becomes useful for all content.

But in general I feel like export and import is a feature you don’t really want to expose to all of your users.

It’s now possible to customize the available exporters for each element type (and source) in Craft 3.4, via a new EVENT_REGISTER_EXPORTERS event. You could register new exporters (#5090) or remove them.

use craft\elements\Entry;
use craft\events\RegisterElementExportersEvent;
use yii\base\Event;

Event::on(Entry::class, Entry::EVENT_REGISTER_EXPORTERS, function(RegisterElementExportersEvent $e) {
    $e->exporters = [];
});

We’ve also added a new “Expanded” export type that includes all relevant custom field values (including Matrix and relational fields), and can be optionally saved as a JSON file. So the built-in export functionality should be more useful to begin with :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

michel-o picture michel-o  Â·  3Comments

leigeber picture leigeber  Â·  3Comments

richhayler picture richhayler  Â·  3Comments

angrybrad picture angrybrad  Â·  3Comments

michaelhue picture michaelhue  Â·  3Comments