Yes, you are right. Image alt cannot be added in combine fields filter in a v...

Contribution Date
Technology
Contribution Project
Contribution Details

Yes, you are right. Image alt cannot be added in combine fields filter in a view. You can alter the view query for a specific project though. For that, you will have to add the image field in combine filter and alter the query in hook_views_query_alter. You can try the following code in your module file:

<?php use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\query\QueryPluginBase; /** * Implements hook_views_query_alter(). */ function MODULE_views_query_alter(ViewExecutable $view, QueryPluginBase $query) { // fetch the specific view and the display id if ($view->id() == 'your_view_id' && $view->getDisplay()->display['id'] == 'display_id') { foreach ($query->where as &$condition_group) { foreach($condition_group['conditions'] as &$condition){ //find if the string exists if(strpos($condition['field'], 'CONCAT_WS') !== false){ $find = 'field_image_target_id'; $replace = 'field_image_alt'; //replace target_id with alt $field = str_replace($find, $replace, $condition['field']); $condition = [ 'field' => $field, 'value' => $condition['value'], 'operator' => $condition['operator'], ]; } } } } } ?>

Although, this is not the best approach, it will work for the mentioned feature. Hope this helps for your specific project. Will update if I find any alternate approach.
Note: In your combine filter, you will need to set your operator as "contains" instead of "equal to"

Issue Status
Active
Contribution Author
Files count
0
Patches count
0