-
Hello, downloads:
-
name: 'sample-file'
file: spectacles/2.jpg
type: download
enabled: true
espace_pro: false
description: 'A random description'
-
link_text: sample-url
link: 'entry::981e2720-779e-441e-b781-daefb04f9950'
type: link
enabled: true
espace_pro: true public function index($value, $params, $context)
{
$array_test = array(
array(
'espace_pro' => true
),
array(
'espace_pro' => false
),
);
// $entries = collect($array_test); // works
$entries = collect($values);
return $entries->filter(function ($entry) {
// var_dump($entry['espace_pro']); // object(Statamic\Fields\Value)#2708 (5) { ["raw":protected]=> bool(false) ["handle":protected]=>
return $entry['espace_pro'] === true;
});
}
``` |
Beta Was this translation helpful? Give feedback.
Answered by
LeoSeyers
Dec 7, 2021
Replies: 1 comment
-
Ok, just found the problem. public function index($value, $params, $context)
$entries = collect($values);
return $entries->filter(function ($entry) {
return $entry['espace_pro']->raw();
});
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
LeoSeyers
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok, just found the problem.
Data was "augmented" and needed to be accessed via ->raw() method.
https://statamic.dev/extending/augmentation#value