I was reviewing #4509 and was playing with @indigoxela's PR on my local, trying to conditionally show/hide a warning if webp was added to the list of allowed extensions for an image field instance.
A condition like this, where the value is "static" works fine:
'#states' => array(
'visible' => array(
':input[name="instance[settings][file_extensions]"]' => array('value' => 'png, gif, jpg, jpeg, webp'),
),
),
But the goal is to check the value of the field for any occurrence of webp. Unfortunately, #states doesn't seem to support regex OOTB
With some research, I've found this article: https://evolvingweb.ca/blog/extending-form-api-states-regular-expressions which would allow something like this:
'#states' => array(
'visible' => array(
':input[name="instance[settings][file_extensions]"]' => array('regex' => array('value' => '^.*webp.*$')),
),
),
Recent comments
This behaviour in CKEditor 5 is almost always triggered by a JavaScript failure during editor initialization. When CKEditor cannot fully load, it silently breaks core features like saving...
CKEditor 5 Not Saving Changes, Can't Access Source
I recently did this for my website and it increased my PageSpeed score significantly. I just installed and configured the following modules: Alt/Title Default (to set default...
How to Improve SEO Performance in Backdrop CMS
Welcome to Backdrop CMS! To start, I recommend two basic modules: https://backdropcms.org/project/seo_meta and https://backdropcms.org/project/easy_xmlsitemap. I hope they are...
How to Improve SEO Performance in Backdrop CMS