Fluid icon indicating copy to clipboard operation
Fluid copied to clipboard

f:contains ViewHelper

Open s2b opened this issue 6 months ago • 0 comments

A new <f:contains> ViewHelper should be added to Fluid, which checks if a provided value either exists in the provided array or in the provided string. If both the array and the string are provided, an exception should be thrown. This ViewHelper should extend the AbstractConditionViewHelper.

Arguments:

  • mixed $value (needs to be scalar if f:contains is used with the string argument)
  • array $array
  • string $string

See also the php in_array() and the php str_contains() functions.

Examples:

<f:contains value="foo" array="{myArray}">

</f:contains>
<f:contains value="foo" string="{myString}">

</f:contains>

<f:variable name="result" value="{f:contains(value: 'foo', array: myArray)}" />

s2b avatar Jun 26 '25 09:06 s2b