Do you have any opinions on a backport of this module for Drupal 7?

We have a client requesting a feature to unify the number formats of hundreds of telephone numbers already stored in the system. So we decided to use the giggsey/libphonenumber-for-php library for it. So it will become basically a quite similar approach, to what you already have implemented for D8.

I haven't see any D7 module so far, that offers such a formatter and the Phone module seems to be not actively maintained and suggested to create a Formatter module for the backport of the D8 telephone field

What do you think?

Comments

szeidler created an issue. See original summary.

zaporylie’s picture

TL;DR Sure, why not :)

As long as it applies to Dave Reid's backport of telephone field, one you've mentioned, and not the Phone module, I believe we can create 7.x branch and, more or less, directly backport it. I mention this because it was always important to me that this module (and telephone_validation) was created to complement telephone ecosystem (one from Drupal 8 core, and its backport to Drupal 7).

This module was created to solve #2004144: tel: link is improperly formatted but, as it seems, its potential is more than single use case.

Would you like to help with backport?

zaporylie’s picture

Version: 8.x-1.x-dev » 7.x-1.x-dev

Created branch (out of 8.x). Time for initial patch :)

szeidler’s picture

Thanks for opening the branch.

Would you like to help with backport?

Yes, for sure. I planned to work on that feature for our client sometime during may. I can provide an initial patch then. Better to to spend the effort in a contributed approach, than an isolated custom module that sleeps in a private client repository.

szeidler’s picture

Category: Plan » Task
Status: Active » Needs review
StatusFileSize
new29.1 KB

Got some time to work on it on Friday. Here's my initial patch more or less straightforwardly backporting the D8 functionality including tests to keep both branches as close as possible.

szeidler’s picture

I tested the installation in a composer based environment, which is working fine. I saw, that telephone_validation depends on composer_manager, but my patch doesn't. The current implementation would fail, because of the hook_requirements() class check and composer_manager resolving the dependencies after enabling a module.

So solve that scenario I added a check to hook_requirements() to check , if composer_manager is installed. So it should work with all possible composer strategies.

I like your ideas on it. But at the end telephone_formatter and telephone_validation should use the same approach.

zaporylie’s picture

Status: Needs review » Fixed

Great work @szeidler! I believe this is good starting point to go for 7.x-1.x branch so I committed it and added you to composer.json as module's co-author. There are some nitpicks, like coding style violations, but is shouldn't stop us from releasing usable module for D7.

I love the idea of getting rid of composer_manager dependency and I was actually thinking about doing the same for telephone_validation module, and other modules with composer dependencies I maintain. There was a day when that approach was best/only one - now we have better alternatives such as mentioned drupal-composer/drupal-project + modules like https://www.drupal.org/project/composer_autoloader.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.