protected static function Filter::expandItem in JSON:API Search API 8
Expands a filter item in case a shortcut was used.
Possible cases for the conditions: 1. filter[uuid][value]=1234. 2. filter[0][condition][field]=uuid&filter[0][condition][value]=1234. 3. filter[uuid][condition][value]=1234. 4. filter[uuid][value]=1234&filter[uuid][group]=my_group.
Parameters
string $filter_index: The index.
array $filter_item: The raw filter item.
Return value
array The expanded filter item.
1 call to Filter::expandItem()
- Filter::expand in src/
Query/ Filter.php - Expands any filter parameters using shorthand notation.
File
- src/
Query/ Filter.php, line 220
Class
- Filter
- Gathers information about the filter parameter.
Namespace
Drupal\jsonapi_search_api\QueryCode
protected static function expandItem($filter_index, array $filter_item) {
if (isset($filter_item[EntityCondition::VALUE_KEY])) {
if (!isset($filter_item[EntityCondition::PATH_KEY])) {
$filter_item[EntityCondition::PATH_KEY] = $filter_index;
}
$filter_item = [
static::CONDITION_KEY => $filter_item,
static::MEMBER_KEY => $filter_item[static::MEMBER_KEY],
];
}
if (!isset($filter_item[static::CONDITION_KEY][EntityCondition::OPERATOR_KEY])) {
$filter_item[static::CONDITION_KEY][EntityCondition::OPERATOR_KEY] = '=';
}
return $filter_item;
}