Last active
July 25, 2018 14:36
-
-
Save DuaelFr/6ac40cc1f686e227111ec8cd9a46033f to your computer and use it in GitHub Desktop.
Outputs the list of entity types and uuids contained by a content directory of a default_content module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# How to use this script? | |
# | |
# 1. create an empty module that depends on default_content or reuse an | |
# existing one. | |
# 2. use `drush dcer --folder=path/to/module/content ENTITY_TYPE ID` | |
# to add default content to your module. | |
# 3. once all your content is in your module, clean up the content folder | |
# to only keep the content you need (ie. remove users most of the time). | |
# 4. run `defcontent.sh path/to/module/content` then copy the output in | |
# your module info.yml file. | |
# | |
# Now, if you only need to update the content, you can just use | |
# `drush dcem my_module`. | |
if [ ! $1 ]; then | |
echo "Usage: $0 [directory]" | |
echo "where \`directory\` is the path to the 'content' directory of your module" | |
exit 1 | |
fi | |
cd $1 | |
echo "default_content:" | |
for D in */; do | |
echo " $D" | sed "s#/#\:#" | |
for F in $D/*.json; do | |
UUID=`echo $F | sed "s#.json##" | sed "s#$D/##"` | |
echo " - $UUID" | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example output: