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
Hi Enthusiast, I had that problem with a site a while back and in that case it was a hosting problem with IPv6, which didn't work properly on the server this site was on. I updated...
Error when trying to check for updates
Hi. Welcome to Backdrop. Out of the box, there are two places you can set visibility by user ID and they are related: The layout configure screen under "Visibility conditions" (admin/structure/...
Use visibility User by uid
Start with clean URLs, add Pathauto and Metatag modules, submit your XML sitemap to Google Search Console, and keep your content original and well-structured.
How to Improve SEO Performance in Backdrop CMS