From 753d330f19438d3d675421e1ffb292cfbaa5dc52 Mon Sep 17 00:00:00 2001
From: Antonio Ospite <ao2@ao2.it>
Date: Mon, 27 Aug 2018 16:01:43 +0200
Subject: [PATCH] create-profile.sh: fix also the submit callback when creating
 a new profile

When creating a new profile from an existing one, fix also the usage of
the submit callbacks, not only the functions names.
---
 libexec/create-profile.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libexec/create-profile.sh b/libexec/create-profile.sh
index 370963d..57e3731 100755
--- a/libexec/create-profile.sh
+++ b/libexec/create-profile.sh
@@ -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
 
-- 
2.1.4