Below is my antlers partial in Statamic V3
{{ if logged_in }}
{{ user }}
{{ if likes != null }}
{{ if (likes | in_array:id) }}
<a href="javascript:void(0)">
<span class="material-icons ml-2 mt-2 bookmark-button" data-action="/!/likes/dislike/{{ page:id }}">
bookmark
</span>
</a>
{{ else }}
<a href="javascript:void(0)">
<span class="material-icons ml-2 mt-2 bookmark-button" data-action="/!/likes/like/{{ page:id }}">
bookmark_border
</span>
</a>
{{ /if }}
{{ /if }}
{{ /user }}
{{ /if }}
in this code, I simply want to check if likes array exists or not, if yes then only do further logic processing
but what I get is this
Facade\Ignition\Exceptions\ViewException
in_array() expects parameter 2 to be array, null given
I even checked this
{{ if likes }}
instead of
{{ if likes != null }}
still, I get the same error
Is there a way where I can check whether this likes array exists or not and only then proceed further?