Hi all
Fairly new to using ECK really helpful thanks in advance.
Just one small issue for me right now. When I create a new Entity Type and add a name Machine-readable name (A unique machine-readable name. Can only contain lowercase letters, numbers, and underscores.) is the message in the admin.
The problem is I can't add a - (dash) to the name. This means all my urls (addresses in the browser) all have a underscore.
Example:
whats on = entity type
events = bundle
example.com/whats_on/events
What I'd really like is:
example.com/whats-on/events
Isn't there a way to add - instead of _ ?
Or a way to change the address so things are more user friendly?
Thanks for any guidance,
Barry
Comments
Comment #1
computerbarry commentedCan anybody help with this?
Is this a bug, a feature something we can fix?
Thanks, Barry
Comment #2
fmizzell commented@computerbarry Thank you for bringing this up. I do think that it is some sort of unspoken rule to use - instead of _ for urls. I think we could make that change. I am currently trying to get an alpha for 3.x out, so I will probably not have time to concentrate on this, but if you would like to submit a patch with the fix that would be great :)
Comment #3
fmizzell commentedComment #4
nevets commentedThe underscore is valid in a PHP variable name, the dash is not. So that is why machine names use the underscore. I believe content types translate the underscore to a dash when generating paths.
Comment #5
computerbarry commentedAbsolutely fmizzell. Very surprised this wasn't thought of at first.
I wish I could. Still very much a new Drupal Developer so slightly out of my skills right now.
Would be great if we could add this into one of the next releases or if anybody has time to create a patch. Brought one of my projects to a halt unfortunately have to use some sort of work around. Less words, no spaces :(
Thanks for getting back and look forward to any new releases.
Good work!
Thanks, Barry
Comment #6
computerbarry commentedCorrect nevets. But how do we now translate this with Entity Types?
Another question I have is: Can we hide the Entity Type name altogether and just show the bundle name in the url somehow?
Barry
UPDATE
Until things get updated, hopefully in the next release. I suggest the Pathauto Entity Module I've set this up without any problems, Pathauto's side kick for Entities :) https://www.drupal.org/project/pathauto_entity
Comment #7
robloachI don't believe we'll be supporting `-` in there as it's a machine name.