Skip to content

Commit

Permalink
Merge pull request #335 from City-of-Helsinki/UHF-9080
Browse files Browse the repository at this point in the history
UHF-9080 react fallback
  • Loading branch information
rpnykanen authored Oct 19, 2023
2 parents dd0973e + 6f9eac9 commit e64c29b
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 1 deletion.
46 changes: 45 additions & 1 deletion conf/cmi/views.view.job_listing_search.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,44 @@ display:
label: ''
field_identifier: ''
exposed: false
arguments: { }
arguments:
field_task_area_target_id:
id: field_task_area_target_id
table: node__field_task_area
field: field_task_area_target_id
relationship: none
group_type: group
admin_label: ''
plugin_id: numeric
default_action: default
exception:
value: all
title_enable: false
title: All
title_enable: false
title: ''
default_argument_type: query_parameter
default_argument_options:
query_param: task_areas
fallback: all
multiple: and
default_argument_skip_url: false
summary_options:
base_path: ''
count: true
override: false
items_per_page: 25
summary:
sort_order: asc
number_of_records: 0
format: default_summary
specify_validation: false
validate:
type: none
fail: 'not found'
validate_options: { }
break_phrase: false
not: false
filters:
status:
id: status
Expand All @@ -182,6 +219,7 @@ display:
plugin_id: bundle
value:
job_listing: job_listing
group: 1
expose:
operator_limit_selection: false
operator_list: { }
Expand Down Expand Up @@ -227,6 +265,10 @@ display:
default_group: All
default_group_multiple: { }
group_items: { }
filter_groups:
operator: AND
groups:
1: AND
style:
type: default
row:
Expand All @@ -251,6 +293,7 @@ display:
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- url.query_args
- 'user.node_grants:view'
- user.permissions
Expand All @@ -267,6 +310,7 @@ display:
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- url.query_args
- 'user.node_grants:view'
- user.permissions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use Drupal\media\OEmbed\ResourceException;
use Drupal\migrate\MigrateSkipRowException;
use Drupal\node\NodeInterface;
use Drupal\paragraphs\ParagraphInterface;
use Drupal\views\Plugin\views\query\QueryPluginBase;
use Drupal\views\ViewExecutable;

/**
* Implements hook_entity_bundle_info_alter().
Expand Down Expand Up @@ -448,6 +450,37 @@ function helfi_rekry_content_preprocess_block(&$variables) {
}
}

/**
* Implements hook_views_query_alter().
*/
function helfi_rekry_content_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
if ($view->id() !== 'job_listing_search') {
return;
}

if (!isset($query->where[0]["conditions"][0])) {
return;
}

$task_area_external_id = $query
->where[0]["conditions"][0]["value"][":node__field_task_area_field_task_area_target_id"];

if (!$task_area_external_id) {
return;
}

/** @var \Drupal\taxonomy\Entity\Term $term */
$terms = \Drupal::entityTypeManager()
->getStorage('taxonomy_term')
->loadByProperties(['field_external_id' => $task_area_external_id]);
if (!$terms) {
return;
}

$term = reset($terms);
$query->where[0]["conditions"][0]["value"][":node__field_task_area_field_task_area_target_id"] = $term->id();
}

/**
* Implements hook_page_attachments().
*/
Expand Down

0 comments on commit e64c29b

Please sign in to comment.