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.
What should one write in the custom selector box? Custom function name and define it in code? Regular expression?
Thank you!
Comment | File | Size | Author |
---|---|---|---|
#9 | 2938814-9.patch | 9.54 KB | jrockowitz |
| |||
#7 | 2938814-7.patch | 2.11 KB | jrockowitz |
#7 | Screen Shot 2018-01-23 at 4.48.38 PM.png | 123.84 KB | jrockowitz |
Screen Shot 2018-01-23 at 11.57.44.png | 57.41 KB | hkirsman |
Comments
Comment #2
hkirsman CreditAttribution: hkirsman commentedComment #3
hkirsman CreditAttribution: hkirsman commentedComment #4
hkirsman CreditAttribution: hkirsman commentedBy accident found that it seems to be css selector. May be add example there or more info?
Comment #5
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedDrupal's #states API allows you to enter any type of selector for a #states trigger. These custom triggers selectors are not processed via server-side validation.
If an input which is being used for a #state is deleted its selector will appear in 'Custom selectors' as ':input[name="ELEMENT_KEY"]'
A few thoughts...
I am open to suggestions.
Comment #6
hkirsman CreditAttribution: hkirsman commentedI don't know how to make the functional part better but rather how user, coming to the admin page for the first time, should understand what to do there with the custom selector.
Comment #7
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedHow about we just remove support for custom selector? If someone enters a custom selector in YAML it will be appended to select menu.
The attached patch is going to break some tests which should be easy to fix.
Comment #9
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #11
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #12
hkirsman CreditAttribution: hkirsman commentedI would have seen something like instead of "Enter custom selector..." placeholder something like "Enter CSS selector...". Or write longer help sentence below the input. It's nice feature, why remove it.
Comment #13
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedIt made no sense because custom selectors were not supported via server-side conditional logic. Non-technical users would have no idea how it works. I literally could not think of a reasonable example of when anyone would use a custom selector.
Anyone who understands Drupal's #states API can still enter custom selectors via the YAML source editor and they will work as expected.
Comment #14
hkirsman CreditAttribution: hkirsman commentedWe need to make a condition based on some variable from the system. It's not perfect but we'll add hidden form element and check the variable from there.
I'm technical person and it didn't make sense to me too :P But it was because the text was so generic.
Comment #15
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedYes, it has crossed my mind to allow tokens to be used as selector/trigger.
If would be really cool if we could hide/show/require an element based on the current user's language.
I have absolutely no idea how we would set this up.