Problem/Motivation

We have now config entity which store export configuration. Let's use them in the export form.

Remaining tasks

Allow to use the config entities instead of custom user configuration in the main export form.

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

flocondetoile created an issue. See original summary.

  • flocondetoile authored 2a0b6e8 on 8.x-1.x
    Issue #3166121 by flocondetoile: Allow to use entity export csv...

  • flocondetoile authored 5a8bd9b on 8.x-1.x
    Issue #3166121 by flocondetoile: Allow to use entity export csv...
aiphes’s picture

Suscribe to this feature because I don't understand what is the point. Drush usage ?
Because I need to set again Machine name instead of label every time I do an export... :( I thought config could avoid this .

flocondetoile’s picture

Because I need to set again Machine name instead of label every time I do an export

You can save your settings when exporting per entity type / bundle. And soo next time you want to export same bunde, your user's settings are used.

because I don't understand what is the point.

This issue is to use config entities which have an export configuration on the export form yes. And be used also via drush if needed.

Any patch is welcome.

aiphes’s picture

Understood. Actually when I save a setting when I redo an export some fields doesn't keep the previous settings. But part of the job is done :)
I'm not PHP dev so I can't help on patch ;)

flocondetoile’s picture

some fields doesn't

This shouldn't occur. Please fill an issue, with reproductible steps, for these export configuration field which are not saved, and reused on the next export.

Fool2’s picture

I think the solution here is a "revert to default" button maybe on each entity type. And maybe a drush command to wipe the settings for all users and revert to default, deferring to config if one exists.

If there is a config entity for that export, it will revert to that config. Right now, that config is never used, it seems, even on a fresh install of the module.

In the form logic there is a TODO in comments

// @TODO handle configuration values
$configuration_default = isset($user_default_values[$field_name]['form']['options']) ? $user_default_values[$field_name]['form']['options'] : [];

It seems like there should be a $config_default instead of [] where it gets the data from config. But the UX is not clear, which is why I would suggest having a "revert" or "reset" button that essentially deletes the $user_default_values that is stored per-user.

flocondetoile’s picture

The goal of this issue is to kept current behavior, the manual export (saved per user if checked), and expose configuration export (if they exists for the entity type / bundle). This could be a select list with an entry "manual export" which expose all the field configurations, and others entries for each configuration export (and if selected which hide all the field configurations).

Currently we can only use configuration export via custom code. Or width a drush command (see #3110170: Provide a drush command).

Fool2’s picture

That makes sense. But I think there are two use cases we can add to this situation and take advantage of the config.

  • The module was just installed and the user has never done an export. The config should determine what shows up the first time a new user uses the export form.
  • A new entity/bundle is enabled for export by the admin. The user has never done that export before. The config should determine what shows up the first time a new user uses the export form.

The use case I am thinking is if you are delivering a website with export functionality to the client, you may want to set up some settings for them in config instead of them having to figure out all the formatting options. The same for any new user to the system.

flocondetoile’s picture

So we could have :

Default values based on an export configuration, if no user configuration found. The question is about if there is multiple export configurations for the same entity type / bundle. Does this need to be configurable ?

This shows some possible uses cases where we don't want a user have access to the whole export form, because "too complex". May be some permissions could answer to these use case. The basic permission could be about "access manual export" and "access configured export".

Fool2’s picture

What would also help is an API documented or in-UI block/widget creator that we can say "Here is a button to generate this export, according to this config set"

The alternative to this module is using views and views_data_export spending lots of dev time wiring up all the fields and formats and permissions for every single entity. I think that is overkill for many usecases, which this module can more directly address. For instance, a site owner wants to export structured but human-readable data into another software to do data analysis.

bkudrle’s picture

FileSize
84.89 KB

I made a crude mockup according to my idea of what this issue is looking for. It is shown below.

Mockup of Using Saved Config

I added the 'Use Saved Configuration' drop down. This assumes that the 'Basic Page Configuration Setting 1' and 'Basic Page Configuration Setting 2' are configurations that the user has saved for a Basic Page on the Entity export csv configuration entities page (/admin/config/content/entity-export-csv/configurations). After the selection is made from this drop down, then the values for all of the fields will be populated according to the item that was chosen.

I left None as the default choice, which I am assuming would enable all of the fields as a default. Or, perhaps per the discussion so far, we might want to have None display the default from what the user has already saved. Or perhaps we want to have another choice of 'Default' for using what the user saved from their previous usage. That would seem to be another aspect open for discussion.

Am I on the right track here? Is this along the lines of what you had envisioned for this issue? Are there things that should be changed?

Looking forward to feedback about this.

Defcon0’s picture

I just installed the module and it's quite great. Only thing bothering me is that export config is stored per user and not in yml config. This is not practicable in a multi user setup. A default config on a node type basis would be highly appreaciated.

jviitamaki’s picture

Here's a patch that allows using of configured exports in export csv form while also retaining the original weirdish user data features.