My View
Check This Image First
My Filter
Hello all I am trying to change this highlight field value using hook_views_query_alter....but I am unable to do... Can Someone Help me on this Query Alteration I am writing this code but it's not working
foreach ($query->where as &$condition_group) {
foreach ($condition_group['conditions'] as &$condition) {
if ($condition['field'] == 'paragraphs_item_field_data_node__field_recommendation_tagging__paragraph__field_recommendation_tag.field_recommendation_tag_target_id') {
$condition = [
'value' => $rec_tags,
'operator' => 'in',
];
}
}
}
First of all do you enter in your condition? Verify the fieldname:
paragraphs_item_field_data_node__field_recommendation_tagging__paragraph__field_recommendation_tag.field_recommendation_tag_target_id
If you enter in your condition don't forget to re-add you field in your condition and that your value correspond to the right id:
foreach ($query->where as $condition_group) {
foreach ($condition_group['conditions'] as $condition) {
if ($condition['field'] === $field_name ) {
$condition = [
'field' => $field_name,
'value' => $rec_tags,
'operator' => 'in',
];
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.