Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use correct dsr label for operations #863

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading