Problem/Motivation
Clicking the Submit button seems silly in this situation, but a major error shouldn't be involved when someone does.
Steps to reproduce:
- Install styleguide on a clean copy of Drupal 7
- After enabling, visit admin/appearance/styleguide
- Find the submit button and click it
You should see a white screen with the error:
Fatal error: Function name must be a string in /[your-directory]/includes/form.inc on line 3534
This error comes from form_validate_machine_name() in form.inc.
Proposed resolution
This happens because a machine_name field is always validated if the submitted value is different than the #default_value. Because there is no #default_value assigned in this module, it will always happen. Even if there was, a user changing it and clicking submit would still trigger this. There needs to be an 'exists' function assigned, as documented in the Form API: http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.ht...
Comment | File | Size | Author |
---|---|---|---|
#6 | styleguide-machine_name_exists_error-1797282-6.patch | 925 bytes | guschilds |
#1 | styleguide-machine_name_exists_error-1797282-1.patch | 942 bytes | guschilds |
Comments
Comment #1
guschilds CreditAttribution: guschilds commentedAs described in the issue description, this patch adds a call to a new function within the styleguide module to determine whether or not the machine_name field already exists. Because this machine_name isn't important, nor is it actually getting used, the function simply returns FALSE.
The error described should no longer happen and the styleguide page will simply reload, just as it does in the 6.x version.
Comment #2
guschilds CreditAttribution: guschilds commentedComment #3
agentrickardOdd bug but proper fix, I suppose. Minor formatting issue with the docblock needs to be cleaned up.
Comment #4
guschilds CreditAttribution: guschilds commentedThanks for reviewing. What is the formatting issue? I can get it cleaned up if needed.
Comment #5
agentrickardComment #6
guschilds CreditAttribution: guschilds commentedThanks for pointing this out. Had to reread the documentation guidelines.
I fixed the formatting and attempted to make the comments more appropriate and consistent with the rest of the module.
Comment #7
agentrickardCommitted.