$get('../../parent_field_name') is used to get a field outside the repeater, but what's the inverse?
in case I want to access a field inside the repeater, from outside the repeater.
I tried something like this $get('relationship_name/item1/field_name') but it doesn't work
Thanks
7 Replies
$get('repeater_name')
will return the repeater state (array)so if I want to access one of its properties I can just do
$get('repeater_name')['property_name']
?
how would it work with $set
instead? if I want to set a property inside the repeater array, from outside the repeater.
thanks LeandroNo because you need to loop through the results it would be:
You cant's set inside from outside a specific field inside, but you can get each item, loop through then update and set the new array.
oh right, that was a naive error, thank you
can I avoid the foreach? I only need to access the first item. Would
$get('repeater_name')[0]['property_name']
work?Not like that, you need to select first and you don't know the id so:
hey, thank you.
I've tried doing this:
but it throws the error: "only variables should be passed by reference"
array_shift()
modifies the passed array, so you need to store it in a method first. You can't directly use $get()