Problem/Motivation
TelephoneItem declares default_formatter = "basic_string". However, only string (and telephone_link) but not basic_string is available as a formatter for telephone fields.

Proposed resolution
Fix the default formatter to be string.
Note that we could also change it to telephone_link. It's arguable which choice would be more backwards-compatible: Right now basic_string does actually get used when rendering by default (see FormatterPluginManager::getInstance()) and code string is functionally equivalent to that by default (i.e. when the link_to_entity setting is set to FALSE). However, when visiting the Manage display form, the telephone_link formatter is selected by default, because it is the first one. So just visiting that page and saving it without any (explicit) changes will configure telephone_link to be used.
Alternatively we could also make basic_string availabe for telephone fields. But both string and basic_string have the same label ("Plain text"), so we would have to fix that, as well, in order to not make the UI confusing.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 3130240-10-test-only.patch | 5.77 KB | ravi.shankar |
| #7 | interdiff_2-7.txt | 2.35 KB | ravi.shankar |
| #7 | 3130240-7.patch | 7.46 KB | ravi.shankar |
| #2 | 3130240-2-test-expansion.patch | 7.23 KB | tstoeckler |
| #2 | 3130240-2-test-only.patch | 6.58 KB | tstoeckler |
Comments
Comment #2
tstoecklerHere's a patch with the proposed fix.
In thinking about test coverage I found
FieldDefinitionIntegrityTestwhich I would have thought would catch this. It turns out that that only checks that the default formatter exists in general, not that it applies to that field type. So I think that would be the proper test coverage.But, of course, expanding that test shows further failures: The
datetime_timestampformatter does not allow thechangedfield and thestringformatter does not allow theuuidfield. So also attaching a patch that fixes those issues, as those are fairly straightforward.And also attaching a should-fail patch with the above but without the telephone item fix to validate the changes to the test coverage.
Comment #3
tstoecklerI should note that I'm not sure if the issues reported in #2 should all be fixed here of if we should split this into multiple issues. I just wanted to (get and then) provide a full picture of the situation and provide a way to fix it as a whole. I do not in any way mind if committers prefer this is different steps.
Comment #6
chi commentedThis method has been deprecated.
I think fixing the other two similar bugs (#2) here makes sense as the also covered by provided test.
Comment #7
ravi.shankar commentedHere I have tried to fix comment #6.
Comment #8
chi commented@ravi.shankar Can you provide test only patch as well?
Comment #10
ravi.shankar commentedHere I have added test only patch.
Comment #11
chi commentedThat's wrong usage of
assertTrueComment #13
chi commentedI think the whole test needs to be refactored to replace conditional pass/fail statements with
assertContainsorassertArrayHasKey.