label(); } elseif ($value instanceof FieldItemListInterface) { $string_to_test = $value->value; } else { return; } if (strpos($string_to_test, 'love Drupal') === FALSE) { $this->context->addViolation($constraint->message); } } }