While working on #3157, I happened to face some challenges. Researching for a possible solution, I came across an API change/addition that was made in D8 that could possibly help, so I have filed #3440 (didn't want to derail #3157).
So here's how I can best explain why I filed this issue here:
The logic in
form_process_actions()
is to be adding thebutton-primary
class to whichever submit button comes first in a form. This is a good thing DX-wise, because the developers/themers need not worry about setting classes; they only need to set the button order (using the#weight
attribute). But this works as expected only when the form submit buttons are "static". Soon as you start using#states
to show/hide submit buttons, all sorts of weird things start to happen.I found that the problems/WTFs start happening when you want to conditionally set which button should be the primary one. In the save_draft module, how this was addressed was to add the
button-primary
CSS class to the submit button by using the#attributes
attribute in Form API. This would result in the button having bothbutton-primary
andbutton-secondary
CSS classes though. Thebutton-secondary
class is then removed via javascript. This is just silly, but I see no other workaround .Although an improvement, #3440 would not help with this, because a
#button_type
attribute would still be set via php (before rendering the submit buttons), while#states
works by adding js that shows/hides or enables/disables elements etc. We currently have the following states available:- enabled
- disabled
- required
- optional
- visible
- invisible
- checked
- unchecked
- expanded
- collapsed
This issue here is to propose the addition of a new set of primary
/secondary
states, to be used with '#type' => 'submit'
, which will be adding/removing the respective CSS classes.
Recent comments
Correct, if you add multiple condition statements they are treated as AND so it would appear to the system as: node/103 AND node/91 which will never happen. Glad you found the way to...
Blocks (custom) not displaying in Harris sidebars with visibility condition set to more than one url path (node)
YES! That works. This whole thing is extremely bizarre, though. On the site I'm building (not the sandbox demo), I had a view that was displaying multiple images correctly (i.e. once, not...
Duplicated images in view
Maybe "Query settings" : "Distinct". If there are multiple identical items, each will be displayed only once. You can use this to try and remove duplicates from a view, though it...
Duplicated images in view