Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
base system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
25 Apr 2018 at 23:57 UTC
Updated:
13 Dec 2022 at 18:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mpaler commentedComment #3
chrisolofNice! A few suggestions:
- Document your hook with a simple working example in system.api.php.
- Fix spelling of "overide" on this line:
// Enable other modules to overide core email validation.Maybe something like
// Allow modules to override.would suffice.- Maybe: rename
$validationto$validto better indicate the boolean nature of the variable.Comment #4
chrisolofComment #5
mpaler commented@chrisolof thanks for the suggestions. Adjust patch attached.
Comment #6
mpaler commentedAdjust api documentation.
Comment #7
cilefen commentedComment #8
th_tushar commentedFixed coding standards and variable usage issue.
Comment #10
joseph.olstadPlease do not be alarmed by "composer Command Failed" - this is not an indication of a problem with the patch.
It occurs since approximately may 4th, there is a known testrunner issue. @mixologic (responsible for the testrunner) is on vacation
#2970950: D7 test runner not working since may 4th 2018 'Composer command failed'
Hopefully @mixologic gets back from his vacation soon.
Comment #11
joseph.olstadComment #13
joseph.olstadComment #14
smulvih2Tested patch in #8, works well!
Comment #15
joseph.olstadHas tests,passes tests,RTBC.Comment #16
poker10 commented@joseph.olstad Where does it have tests? I do not see any in the patch #8.
I have tested and checked the patch and found a lot of coding style issues - most of them in the
system.api.php. Fixed these problems and added a new test to see if the altering works (see interdiff).I see this proposed changes as very usefull, so hopefully it can be moved forward.
Let's check the testbot.
Comment #17
joseph.olstad@poker10 , yes you're correct and thanks for adding the tests!
Comment #18
poker10 commentedAdding another related issue.
If we add the hook proposed by this issue, we do not need to complicatedly solve these related issues (possibly with 3rd party libraries), because each site having problem with this will be able to set its own validation in place. This will add a great flexibility.
Comment #19
poker10 commentedComment #20
klonosThanks @poker10 tests LGTM 👍
However, if I'm reading https://www.drupal.org/docs/develop/standards/coding-standards#cast right, then this line:
$valid = (bool)filter_var($mail, FILTER_VALIDATE_EMAIL);Should be like this instead:
$valid = (bool) filter_var($mail, FILTER_VALIDATE_EMAIL);While at it, the docblock for
hook_valid_email_address_alter()could use some love, to bring lines up to the allowed length of 80 chars where it is possible.Comment #21
klonosComment #22
ravi.shankar commentedAddressed comment #20, please review.
Comment #23
mcdruid commentedDraft CR: https://www.drupal.org/node/3324391 n.b. we'll want to update this with a link to the API docs after the patch is committed.
Comment #25
mcdruid commentedThanks everybody!
(n.b. I've not checked but I doubt the API docs are regenerated quickly enough that the link for the CR will be available yet... that's still a todo for when it's published with the release, if it's not been done before).
Comment #26
poker10 commentedIt seems like it is already available in the API docs: https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_valid_email_address_alter/7.x. I have updated the CR and added the link here.