is it possible to create another folder while executing hook_features_export_render()? I have to export additional files that shall be saved as a file and not inline.

Comments

hefox’s picture

Off top of head, I doubt it as it'd need to call mkdir if the directory doesn't exist, and if no one else is already doing it, it's unlikely the code is in it to do it.

mpotter’s picture

Can you explain your use-case in more detail?

Andre-B’s picture

I tried to export files from some content types and did not want them to be inline.

mpotter’s picture

You mean fields? A content type is just a few lines of code. No reason to put those into separate files. Maybe you want to export them to different features to get them into different files? Sounds like maybe your feature is too big?

donquixote’s picture

Issue summary: View changes

For the record: If you are programming your own module with a new features component type, you can implement hook_features_export_files() to add additional files.

@mpotter is right, a content type itself is just a few lines of code.
However all the strongarm, field_instance and field_base exported along with it leads to notoriously huge files, and are a frequent cause of merge conflicts.
Having this split up into one file per item (per field instance, etc) would be a huge DX improvement.

Something I noticed (how I found this thread) is that the mkdir in _drush_features_export() is not recursive, so it only creates one level of directories. See #3060408: Support nested subdirectories for $files['_files'].