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 field name for tagset #921

Merged
merged 1 commit into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions src/Fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,9 @@ protected function wf_crm_get_fields($var = 'fields') {
}
}
}
$tag_display_field = $this->utils->tag_display_field();
$all_tagsets = $this->utils->wf_crm_apivalues('tag', 'get', [
'return' => ['id', 'name', 'used_for'],
'return' => ['id', $tag_display_field, 'used_for'],
'is_tagset' => 1,
'parent_id' => ['IS NULL' => 1],
]);
Expand All @@ -607,7 +608,7 @@ protected function wf_crm_get_fields($var = 'fields') {
$tagsets = ['' => t('Tag(s)')];
foreach ($all_tagsets as $set) {
if (strpos($set['used_for'], $table_name) !== FALSE) {
$tagsets[$set['id']] = $set['name'];
$tagsets[$set['id']] = $set[$tag_display_field];
}
}
foreach ($tagsets as $pid => $name) {
Expand Down
2 changes: 1 addition & 1 deletion src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ public function hasMultipleValues($element) {
/**
* @return string Which field is the tag display field in this version of civi?
*/
private function tag_display_field(): string {
public function tag_display_field(): string {
if (version_compare(\CRM_Core_BAO_Domain::version(), '5.68.alpha1', '>=')) {
return 'label';
}
Expand Down