public function getCustomFieldsValue(string
$field): array
{ if (!
$this->
hasCustomFieldSupport(__METHOD__
)) { return [];
} $values =
[];
foreach ($this->elements
as $element) { // @phpstan-ignore-next-line not possible to typehint or docblock the trait
$values[$element->
getUniqueIdentifier()] =
$element->
getCustomFieldsValue($field);
} /** @var array<string, mixed> $values */
return $values;
} /**
* Sets the custom fields for all entities in the collection.
*
* The passed array must have the entity id as key and an array of custom fields as value.
*
* Example:
* ```php
* $collection->setCustomFields([
* 'entity-id-1' => [
* 'my_custom_field' => 'value',
* 'my_other_custom_field' => 'value',
* ],
* 'entity-id-2' => [
* 'my_custom_field' => 'value',
* 'my_other_custom_field' => 'value',
* ]
* ]);
* ```
*
* @param array<string, array<string, mixed>> $values
*/