#103217Telephone link - TCA type "link" - can't input phone number without linkwizard
Description
If you have a TCA field with “type” => “link”, and “allowedTypes” => [‘telephone’].
Then you can’t input a phone number in the backend WITHOUT linkwizard, like the following:
+49 581 3548
or
tel:+49 581 3548
Only if i write the phone number in double quotes, like:
“tel:+49 581 3548”
I don’t think this is particularly nice, especially for editors or consistent with the “normal” input fields e.g. email, where you can input mail addresses on the “fly” without opening the linkwizard.
'test_phone_field' => [
'label' => 'test phone link',
'config' => [
'type' => 'link',
'eval' => 'trim',
'default' => '',
'placeholder' => '+49 851 654 754 33',
'allowedTypes' => ['telephone']
],
],
AND sometimes i get the error message, if i try to write directly into the input field:
1: Link type “page” is not allowed for the field “test_phone_field” of the table “tx_myext_domain_model_test”
But maybe this request is more a feature don’t know how we can fix this with the phone number – i think it would be easier and better if we had a own TCA type for phone numbers, like the mail field: ‘type’ => ‘email’ with a new attribute type “pattern”, so every integrator / dev can set this validation “pattern” for their needs.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 4
-
Garvin Hicking changed category 07/31/24, 09:39
-
Mogens Fiebrandt commented 02/27/25, 22:49
-
Georg Ringer commented 03/16/25, 09:14
Problem is that without the quotes,
DataHandleruses$linkParameter = $this->typoLinkCodecService->decode($value)['url'];
and this will split the value by spaces into various sections like url, title, class, … and therefore only the “tel:+49” is used as url.
solution is not that easy, however you could use
AfterTypoLinkDecodedEventto check if the url begins with +{number} and adopt the provided link -
Georg Ringer commented and changed status
NewClosed 03/31/25, 14:52closing issue because currently there is no way to change the current behaviour
I can confirm the behavior:
Link type “page” is not allowed for the field “my_field” of the table “tx_myext_domain_model_myentity”
In my case it was a misconfiguration in the ext_tables.sql.
The field was configured like:
my_field varchar(255) DEFAULT ‘0’ NOT NULL
I believe this caused the field to be interpreted as an internal page link if no value was stored in the field.
I could fix this by changing the sql config to:
my_field varchar(255) DEFAULT ‘’ NOT NULL
In the TCA config i added the default value to the field config:
’default’ => ‘’
And in the database i executed following SQL statement:
UPDATE tx_myext_domain_model_myentity SET my_field = “” WHERE my_field = “0”;