create-profile.sh: fix also the submit callback when creating a new profile
[drupal-init-tools.git] / libexec / create-profile.sh
index 62a5b01..57e3731 100755 (executable)
@@ -116,7 +116,10 @@ find . -maxdepth 1 -type f ! -name "*.info.yml" -printf "%P\n" |
     cp "${original_file}" "$DESTINATION_FILE"
     if file "$original_file" | grep -q PHP;
     then
-      sed -i "s/^function ${CURRENT_PROFILE}_/function ${PROFILE_MACHINE_NAME}_/g" "$DESTINATION_FILE"
+      sed -i \
+        -e "s/^function ${CURRENT_PROFILE}_/function ${PROFILE_MACHINE_NAME}_/g" \
+        -e "s/\$form\['#submit'\]\[\] = '${CURRENT_PROFILE}_/\$form\['#submit'\]\[\] = '${PROFILE_MACHINE_NAME}_/g" \
+        "$DESTINATION_FILE"
     fi
   done
 
@@ -136,7 +139,7 @@ find "${PROFILE_DEST_DIR}/config/install" -type f -exec sed -i -e '/^_core: {  }
 #fdupes -f -1 "${WEB_ROOT}/core/profiles/standard/config/install/" "${PROFILE_DEST_DIR}/config/install/" | xargs rm
 
 # Export the default content if the default_content module is there
-if echo "$ENABLED_MODULES" | grep -q default_content;
+if $DRUSH pm-list --type=module --field=name --status=enabled --pipe | grep -q "^default_content$";
 then
   $DRUSH default-content-export-references --folder="${PROFILE_DEST_DIR}/content" node
 fi