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

Allow processRawFieldData to return a $message #879

Closed
brendo opened this issue Nov 7, 2011 · 3 comments
Closed

Allow processRawFieldData to return a $message #879

brendo opened this issue Nov 7, 2011 · 3 comments
Assignees
Milestone

Comments

@brendo
Copy link
Member

brendo commented Nov 7, 2011

This bug has existed since 2008 and I think will allow some better error messages for fields. In fact, I think this limitation was discovered when building the Members extension by @michael-e but I never noticed the subtle bug.

Inside the Entry->setDataFromPost method lies this line, which essentially logs an error message against a field_id. If something goes wrong in the processRawFieldData function, these lines are meant to display the error message.

The problem is that $m is never set, so the error message will always be There was a problem rendering this page. Please check the activity log for more details.!!

The signature for processRawFieldData needs to be updated to mostly mirror checkPostFieldData($data, &$message, $entry_id = null). Therefore processRawFieldData($data, &$status, $simulate=false, $entry_id=null) would become processRawFieldData($data, &$status, &$message, $simulate=false, $entry_id=null).

This is a breaking API change and will require all developers who have Field extensions to update their extensions, but I feel it's better in the long run than tacking $message onto the end of the current signature.

It will land in 2.3 (and not 2.2.5) for this reason.

@ghost ghost assigned brendo Nov 7, 2011
brendo added a commit that referenced this issue Nov 9, 2011
@brendo
Copy link
Member Author

brendo commented Nov 9, 2011

The above commit:

  • Passes $message as the third parameter to processRawFieldData, pushed $simulate back to the fourth parameter (updates all the core fields - SBL tbd)
  • The $errors parameter from Entry->setDataFromPost will now return an associative array of field_id => message. This is now consistent with Entry->checkPostData.
  • If there are errors during Entry->setDataFromPost on publish pages, the errors will be returned one by one making use of 2.3's multiple alerts (which still need UX/UI work)
  • The Event logic has been updated so that if a field fails during processing, the return output is now consistent with the other errors from Events (returns a @message, @label attributes).

@nilshoerrmann
Copy link
Contributor

Is there a resource anywhere (in the wiki for example) that gathers all breaking changes? Maybe even listing functions that have been removed from the core?

@brendo
Copy link
Member Author

brendo commented Nov 14, 2011

Dev notes #1 is the most exhaustive list sofar (although it doesn't contain this change).

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

No branches or pull requests

2 participants