Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get success message #38

Open
fufu7755 opened this issue Oct 27, 2016 · 6 comments
Open

How to get success message #38

fufu7755 opened this issue Oct 27, 2016 · 6 comments
Labels

Comments

@fufu7755
Copy link

Very good tools!
When I update user or node how to get success message and error message.I saw jDruapl api there are success message, but I could not read it. Please give me a help!

Thank you!

@signalpoint
Copy link
Owner

@fufu7755 Drupal 7 or 8?

@fufu7755
Copy link
Author

Thank you for your reply, I use drupal 7. Drupal 8 api seems to be small.

@signalpoint
Copy link
Owner

@fufu7755 jDrupal doesn't actually display the form success and/or errors either. DrupalGap has a little code snippet that tries to extract the form errors from the responseText during user login and registration: https://github.com/signalpoint/DrupalGap/blob/7.x-1.x/src/modules/user/user.js#L219

You can use that snippet to extract form errors from most resources (I think). As for success messages, no. You'll want your own success handlers to display messages for your application, because AFAIK we can't retrieve the success messages from Drupal, only error messages since they are delivered in the result.

@fufu7755
Copy link
Author

Thank you very much!
I still have a question. Now drupal 8 api less than drupal7, you will continue to improve drupal8? If I use drupal8 whether or not I can get sucess message?
Thank you again!

@signalpoint
Copy link
Owner

@fufu7755 I won't be building any success message into D7 or D8, as I personally feel it is up to the application to decide what success message is displayed. However, it is possible right now to do this in D7 (and probably D8). In D7, you could theoretically use hook_services_request_postprocess_alter() from http://cgit.drupalcode.org/services/tree/docs/services.alter.api.php?h=7.x-3.x to use drupal_get_messagesand append those results to the JSON being delivered to your app, then your app could just iterate over those messages and display them as needed.

@fufu7755
Copy link
Author

fufu7755 commented Oct 27, 2016

@signalpoint Thank you for your help, I hope you can drupal 8‘s angular-drupal better.
Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants