Skip to content

Commit

Permalink
Merge pull request #17388 from opf/bug/59853-multiselect-hierarchy-cf…
Browse files Browse the repository at this point in the history
…-cannot-be-filled-from-wp-list

[#59853] allow editing of hierarchy cfs in wp table
  • Loading branch information
Kharonus authored Dec 9, 2024
2 parents 7f84758 + 24793ae commit 08278f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ export function initializeCoreDisplayFields(displayFieldService:DisplayFieldServ
'TimeEntriesActivity',
'Version',
'Category',
'CustomField::Hierarchy::Item',
'CustomOption'])
.addFieldType(ResourcesDisplayField, 'resources', ['[]CustomOption'])
.addFieldType(ResourcesDisplayField, 'resources', ['[]CustomOption', '[]CustomField::Hierarchy::Item'])
.addFieldType(ResourcesDisplayField, 'resources', ['[]Version'])
.addFieldType(MultipleUserFieldModule, 'users', ['[]User'])
.addFieldType(FormattableDisplayField, 'formattable', ['Formattable'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,5 @@
//++

import { DisplayField } from 'core-app/shared/components/fields/display/display-field.module';
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
import isArrayOf from 'core-app/core/state/is-array-of';

export class TextDisplayField extends DisplayField {
public get valueString():string {
// render a text representation for the assigned attribute, independent of the attribute being a resource,
// an array of resources or a single text value.

if (this.value instanceof HalResource) {
return this.value.name;
}

if (isArrayOf(this.value, HalResource)) {
return this.value.map((r) => r.name).join(', ');
}

return this.value as string;
}
}
export class TextDisplayField extends DisplayField {}

0 comments on commit 08278f3

Please sign in to comment.