On this page
Symfony Expression Constraint
Last updated on
21 August 2023
here is its docs https://symfony.com/doc/current/reference/constraints/Expression.html
it allow you write some twig-like expression :
value in ['php', 'symfony']
which provide similar function as "Specific value(s)" in previous field validation.
This is an example, You can write other expression,
Use case:
add a Expression constraint to field_test, set Expression to "value in ['php', 'symfony']", save it.
if populate field_test "php", no error message.
if populate field_test "123456", get an error message.
Note:
This constraint require "symfony/expression-language": "^6.3".
Help improve this page
Page status: No known problems
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion
Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.