marketing_cloud_example needs a hook_help() function.
Text:
The Marketing Cloud Example module provides an example webform that accepts multiple mobile numbers and SMS text. It then uses a custom webform handler to make a "Post Message to Number" request.
It assumes that you already have an account with Salesforce, and have set up an SMS template, that it will override.
Assuming that you have already configured the Marketing Cloud module: To configure this module, open up the "Marketing Cloud Example" webform >> settings >> emails/handlers >> + add handler. Then click on "Add handler" for "Marketing Cloud Example". Enter the Short code for the message ID from Salesforce and click on save.
Function submitForm() shows a sample generation of the JSON payload, calling the service and handling the results.
Comments
Comment #2
john_a CreditAttribution: john_a as a volunteer commentedPatch create, please review.
Comment #3
john_a CreditAttribution: john_a as a volunteer commentedAccidentally added a use statement in the patch, redone
Comment #4
john_a CreditAttribution: john_a as a volunteer commentedThis is not working as expected, the help is appearing on the config page, and is displayed twice on the help page.
Comment #5
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedline length exceeds 80 characters. You can shorten it something like
Marketing Cloud Example for demonstrating how to use marketing_cloud.
hook_help()
in d8 has these two arguments$route_name, \Drupal\Core\Routing\RouteMatchInterface $route_match
those can be used in switch statement in hook_help.
Best way to implement hook_help is to return the content of README.md/txt file as content returned by hook_help.
Add a README.md file inside this module and then return the content of that file inside hook_help. This way you can avoid maintaining documentation in two places. See https://www.drupal.org/docs/develop/documenting-your-project/module-docu... for more detail.
Comment #6
surbz CreditAttribution: surbz at Srijan | A Material+ Company commented@msankhala Thanks for the covering every detail on writing a good hook_help() in your review.
I have addressed the feedback in #5 in this patch.
Comment #7
surbz CreditAttribution: surbz at Srijan | A Material+ Company commentedComment #8
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedPatch should be created from inside the
marketing_cloud
folder. You created the patch from Drupal core folder which added path likemodules/marketing_cloud/modules/marketing_cloud_example
in patch. Someone may have this module atmodules/contrib/marketing_cloud/modules/marketing_cloud_example
Use single quote around "README.md" to maintain consistency. I have also updated doc.
Comment #9
surbz CreditAttribution: surbz at Srijan | A Material+ Company commentedSure, Thanks!
Comment #10
surbz CreditAttribution: surbz at Srijan | A Material+ Company commentedComment #11
john_a CreditAttribution: john_a as a volunteer commentedThanks @msankhala & @surbz,
That works perfectly. I've added a new dependency for the markdown module into the marketing_cloud module - so that the page renders correctly.
Please can you review.
Comment #12
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commented@john_a You do not need to add this as a dependency because hook_help() adds a check for markdown module so this is an optional dependency. If you add this as dependency then it stops user to install module until the dependency is satisfied. You can mention about markdown module in README.md file itself so that user can install it if he wants to see markdown version of help.
Comment #13
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedI can confirm patch. #9 applies cleanly and shows the README.md contents under
admin/help/marketing_cloud_example
Comment #14
john_a CreditAttribution: john_a as a volunteer commentedApplying patch #9, great work @serbz, thanks for the advice @msankhala.
Comment #15
john_a CreditAttribution: john_a as a volunteer commentedComment #16
john_a CreditAttribution: john_a as a volunteer commentedComment #17
john_a CreditAttribution: john_a as a volunteer commented