Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If I set the machine name of my block display "3g",
After saving the view, the edit page will not show anymore, will only show the name "3g" , other functionalities are fine.
Comment | File | Size | Author |
---|---|---|---|
#2 | machine-name-cant-start-with-number-1872042-2.patch | 704 bytes | Mirroar |
Screen Shot 2012-12-21 at 下午8.13.58.png | 7.37 KB | hanamizuki | |
Screen Shot 2012-12-21 at 下午8.09.27.png | 8.79 KB | hanamizuki |
Comments
Comment #1
dawehnerRight, it's a problem so we should add a validation for the name to require non-numbers at the beginning.
Comment #2
Mirroar CreditAttribution: Mirroar commentedI can confirm this still happens with the latest dev version.
It also only happens with certain numbers (2 and 3 work), and only because in php a statement like (3 == '3g') evaluates to TRUE.
I have attached a patch that should fix the Views UI problem, so we actually don't need to forbid machine names like this.
Comment #4
dawehnerI would argue that we should disallow it right from the beginning AND OR use in_array with strict.
Comment #5
Mirroar CreditAttribution: Mirroar commentedThe problem with disallowing it now: What happens to views that already use these machine names? Also, you can create views in several ways, like the UI and importing, so I'm not sure whether it would be as simple a change.
So far, this UI bug is the only time I've had a problem with the machine name starting with a number, so I'm in favor of this simple fix to views_ui. I wasn't aware of the strict-parameter for in_array, but I can create a new patch when I have some time.