Doesn't work correctly in aggregated view

Created on 18 February 2019, over 6 years ago
Updated 1 May 2025, 3 months ago

PhoneNumberInternationalFormatter::viewElements() generally expects all subfields to be present, no matter whether an extension is collected and entered.
if ($phone_number = $util->getPhoneNumber($item->getValue()['value'], NULL, $item->getValue()['extension'])) {

However, there is one situation where except for ['value'] all other subfields might be absent: this is if the Phone Field is displayed in an aggregated view and (which is the default) only the value is grouped on. While value is set as group_column (so we don't get an SQL error like in πŸ› Switching on aggregation generates fatal "Column not found: 1054 Unknown column" SQL error when using multi-column Fields Needs work ), the other columns or at least ['extension'] need to be grouped as well.

Otherwise (and this is the default) this leads to the extension missing and, with notices being turned on to:

Notice: Undefined index: extension in Drupal\phone_number\Plugin\Field\FieldFormatter\PhoneNumberInternationalFormatter->viewElements() (line 77 of /var/www/html/testing/web/modules/contrib/phone_number/src/Plugin/Field/FieldFormatter/PhoneNumberInternationalFormatter.php). => Array ( [52: Drupal\phone_number\Plugin\Field\FieldFormatter\PhoneNumberInternationalFormatter->viewElements()] => Array ( [file] => modules/contrib/phone_number/src/Plugin/Field/FieldFormatter/PhoneNumberInternationalFormatter.php:77

Unsure if we should just check the 'extension' column's existence or investigate how to make sure the 'extension' column is always grouped on.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

Pancho UTC+2 πŸ‡ͺπŸ‡Ί EU

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024