Is it official policy that identifiers / machine names of export_ui plugins should be alphanumeric? I'm trying to determine the best solution to a problem with the Mailhandler package: #906686: Components in features exports are not correctly displayed in features UI. We define 'mailboxes' using the export_ui, where the name of each mailbox is quite logically the email address associated with it. For the most part this works fine, but it seems to break exports using Features: #1122900: Identifiers with non-alphanumeric characters break Feature creation UI.
I'm trying to determine between Mailhandler, CTools, and Features which module is 'in the wrong' and requires patching. I know it's easy to say 'just use alphanumeric identifiers and it won't be a problem', but I think it would make for a very bad UX to use anything other than an email address for the identifier...
Comments
Comment #1
merlinofchaos commentedThe vast, vast majority of export UI implementations validate to alphanumeric because this identifier is often used in theming and, thus, function names.
Typically the answer is to have a human readable title and a machine readable title that is automatically translated (and in D7 there's the machine_name type that can do it for you automatically. So the answer, IMO, would be to accept "user@example.com' as the "human readable" name and automatically translate that to user_example_com as the machine title. I might even translate the @ to two underscores. Then you do a little duplicate checking if necessary in case two different email addresses translate the same way.
Comment #2
danepowell commentedThank you very much for your response, merlinofchaos. I appreciate the way that you take time to respond to issues, regardless of how pedantic they might seem :)
Comment #3
merlinofchaos commentedNote that, export UI does NOT impose an alphanumeric requirement on the export key (which is the machine name).
All of the defaults impose that requirement, but it's only validated in the UI. Nothing within CTools export.inc actually requires that your machine name be anything other than unique. Meaning that machine names could just as easily be UUIDs (and this is something I want to add in the future).
That might mean that features is imposing this restriction and nobody noticed because almost nobody actually uses machine names that are looser than that.