Skip to content

Commit

Permalink
fix: use correct dsr label for operations
Browse files Browse the repository at this point in the history
Refs: RWR-482
  • Loading branch information
lazysoundsystem committed Dec 10, 2024
1 parent 430bacc commit 7d7fe47
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions html/modules/custom/rwr_sitrep/rwr_sitrep.module
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function rwr_sitrep_menu_local_tasks_alter(&$data, $route_name, RefinableCacheab
if ($group->getGroupType()->id() == 'cluster') {
// Make sure field exists and has a value.
if ($group->hasField('field_cluster_subtype') && !$group->get('field_cluster_subtype')->isEmpty()) {
/** @var \Drupal\taxonomy\Entity\Term $term */
$term = $group->get('field_cluster_subtype')->entity;
if ($term->hasField('field_pdf_enabled') && $term->field_pdf_enabled->value) {
$label = $term->field_collection_label->value ?? $term->label();
Expand All @@ -47,15 +48,17 @@ function rwr_sitrep_menu_local_tasks_alter(&$data, $route_name, RefinableCacheab
/** @var \Drupal\group\Entity\Group $subgroup */
foreach ($subgroups as $subgroup) {
if ($subgroup->hasField('field_cluster_subtype') && !$subgroup->get('field_cluster_subtype')->isEmpty()) {
/** @var \Drupal\taxonomy\Entity\Term $term */
$term = $subgroup->get('field_cluster_subtype')->entity;
if ($term->hasField('field_pdf_enabled') && $term->field_pdf_enabled->value) {
$data['tabs'][0]['rwr_sitrep.local_tasks:rwr_sitrep.operation']['#link']['url'] = Url::fromRoute('view.group_nodes.page_1', ['group' => $subgroup->id()]);
$label = $term->field_collection_label->value ?? $term->label();
$data['tabs'][0]['rwr_sitrep.local_tasks:rwr_sitrep.operation']['#link']['title'] = $label;
$show_operation_sitreps = TRUE;
break;
}
$show_operation_sitreps = TRUE;
break;
}
}

}
}

Expand Down

0 comments on commit 7d7fe47

Please sign in to comment.