Problem/Motivation
When adding a block to a region (on page /admin/structure/block/list/seven, for example) the non-allowed characters (eg. whitespaces) in the human-readable name (eg. "Primary admin actions") are being left out resulting "primaryadminactions" machine name proposed.
However, when a similar operation is performed by adding a new menu to the site (on page /admin/structure/menu/add, for example) the same non-allowed characters (eg. whitespaces) in the human-readable name (eg. "This has multiple words") are replaced with a hyphen ("-") character resulting "this-has-multiple-words" machine name proposed, instead.
This is confusing.
Proposed resolution
A unifyied, coherent logic should work on a site-wide level.
Remaining tasks
Discuss, Agree, Code, Patch, Commit, Documentate.
User interface changes
Note: this issue has nothing to do with the offered option to manually overwrite the automatically generated string proposal.
API changes
Machine names are highly important factor in Drupal's software architecture. Any changes being made on them should be thoroughly think over.
| Comment | File | Size | Author |
|---|---|---|---|
| inconsistent-machine-name-generation.png | 35.4 KB | baluertl |

Comments
Comment #5
chi commentedThe machine names of blocks are really confusing. What makes it worse is that they cannot be changed afterwords. Eventually those names show up in names of preprocess hooks, Twig templates and config files.
Comment #13
Duncan.HY commentedDrupal seems to have a lot of issues with space, underscore, dash.
For space:
Space can have problems in many domains. Like variable name usually can't
have spaces and there are times space is used as deliminators ... etc.
So, it is understanable that space is not desired and dash and underscore
are equally good substitude.
For dash and underscore:
In general, I do not see good reason to eliminate either one of them -
both of them are in ASCII char. set. In general, except conventions,
prefrerances, consistancies ... etc. there really no reason to limited
one or the other.
Consistencies maybe preferred but I do not see it as required - the benefits
are most likely to make people's life easier without the need of checking
it all the time. On the other hand, it really would not break a system.
So, I think, unless there are real reason to eliminate one or the other,
I think we should allow boht since people has different needs - like transfer
things from other system and try to keep things consistent - or just the
preferences of people.
For low impact situations - like module names, which only cause incovience when
install or remove modules, I think we can try to make it consistense. But, on
the other hand, these really would not break the system or require a lot of
efforts to overcome.