Mark asked me to document my problem and my solution for others that may have the same problem:
I have a repeater in ContentBlocks that shows a list of items that can be filtered. Users can set the Filters as a field-settings for each repeater individually.
So Filters are customizable for every repeater-list.
My problem was to get the value (filters) of the repeater field-settting into the dropdown for the items. My solution was to bind a snippet to the dropdown with the following code:
// get CB field
$cbField = $modx->runSnippet('cbGetFieldContent', array(
'field' => 12,
'returnAsJSON' => 1,
'limit' => 1,
));
$cb_values = json_decode($cbField, true);
$filters = explode(',', $cb_values[0]['settings']['filter']);
$options = array();
foreach ($filters as $filter) {
$value = $modx->runSnippet('translit', array(
'input' => $filter,
));
$options[] = array(
'value' => $value,
'display' => $filter,
);
}
return json_encode($options);
(The Translit-Snippet just removes all special characters and trims the whitespaces)
So if may someone has the same problem. Here is an idea how to.