Documentation · ViewHelper reference

XSD schema file | vhs master

Condition / Iterator / ContainsViewHelper

Condition ViewHelper. Renders the then-child if Iterator/array haystack contains needle value.

Example:

{v:condition.iterator.contains(needle: 'foo', haystack: {0: 'foo'}, then: 'yes', else: 'no')}

/

  • Tag usage example

    <v:condition.iterator.contains then="[mixed]" else="[mixed]" condition="1" needle="[mixed]" haystack="[mixed]" considerKeys="1">
    	<!-- tag content - may be ignored! -->
    </v:condition.iterator.contains>
  • Inline usage example

    {v:condition.iterator.contains(then: [mixed], else: [mixed], condition: 1, needle: [mixed], haystack: [mixed], considerKeys: 1)}

Arguments

Argument Description Type
condition

Condition expression conforming to Fluid boolean rules

boolean
considerKeys

Tell whether to consider keys in the search assuming haystack is an array.

boolean
else

Value to be returned if the condition if not met.

mixed
haystack

Haystack in which to look for needle

mixed
needle

Needle to search for in haystack

mixed
then

Value to be returned if the condition if met.

mixed
Required attribute

Revision history

commit da7677bc74f14e9a9300e4ba4487e52c3cb97642
Author: Claus Due <*****@namelesscoder.net>
Date:   Sun Apr 20 01:13:33 2014 +0200

    [TASK] Switch to namespaces

commit 8bb2fc5ee124ba19b0a0ab8e061c9a153fc4651f
Author: Xaver Maierhofer <*****@xwissen.info>
Date:   Sun Jan 18 17:56:13 2015 +0100

    [TASK] Reference Copyright to license.md file

commit cac5db19b9ee4c97ae43c5da67521bbff53a84fc
Author: Claus Due <*****@namelesscoder.net>
Date:   Sun Jan 25 19:41:14 2015 +0100

    [BUGFIX] Make sure LazyObjectStorage is detected before ObjectStorage
    
    Avoids treating LazyObjectStorage as ObjectStorage.