rynpsc / craft-phone-number Goto Github PK
View Code? Open in Web Editor NEWPhone Number field for Craft CMS.
Home Page: https://plugins.craftcms.com/phone-number
License: MIT License
Phone Number field for Craft CMS.
Home Page: https://plugins.craftcms.com/phone-number
License: MIT License
Not really an issue, but is finding entry by this plugin value is possible?
I've tried something like this
Entry::find()->phone("85000000000")->all();
and even something silly like this
Entry::find()
->phone([
"number" => "85000000000",
"region" => "US"
])
->all();
Thanks in advance!
I need the ability for front-end users to update their phone number but it's not currently working as I had hoped.
Can I register the PhoneNumberAsset bundle and use the field from the front end, or is there a way to store the default country code as a hidden field so that it will save?
Thanks!
It would be great if you could pass the format string to getLink the same way you can to format().
So that I could write this
{{ entry.phone.getLink('national') }}
instead of this
{{ entry.phone.format('national') }}
Hi there,
I've just installed your plugin but when I choose it as a field type I get a 500 error in the console and this error in the logs:
2022-05-24 16:22:29 [web.ERROR] [Error] Error: Typed property rynpsc\phonenumber\fields\PhoneNumberField::$defaultRegion must not be accessed before initialization in /vendor/craftcms/cms/src/helpers/Template.php:90
Craft CMS 4.0.3
Phone Number 2.0.0.1
with latest craft 5 version and latest feedme, this isn't working at all
error: _Unable to find the template “feed-me/_includes/fields/base.twig” in "phone-number/integrations/feedme/mapping-template" at line 40.
Originally posted by @funkysoul in #19 (comment)
I need to add some custom validation rules for the phone number field, was trying to do it using EVENT_DEFINE_RULES
model event, but it does not work, because the PhoneNumberModel
class overrides the public function rules(): array
method, any reason this is done instead of defining rules in protected function defineRules(): array
?
Event::on(
\rynpsc\phonenumber\models\PhoneNumberModel::class,
\rynpsc\phonenumber\models\PhoneNumberModel::EVENT_DEFINE_RULES,
function (DefineRulesEvent $event) {
$event->rules[] = [['number'], CustomPhoneNumberValidator::class];
}
);
According to docs:
{{ entry.phone.getCountryCode() }} - The alphabetical country code
{{ entry.phone.getRegionCode() }} - The numerical region code
Actual (php code):
->getRegionCode()
returns the alphabetical country code (ES when using Spanish phone nr.)
->getCountryCode()
returns the numerical region code (34 when using Spanish phone nr.)
This also matches the libphonenumber-for-php docs
Hi,
It's getting an invalid argument exception on "yii\helpers\BaseJson::decode('01234 123 123')"
I think what's happened is I've moved from a plain text field with "01234 123 123" set, and now that's not valid JSON so it's getting upset.
When using the url
Twig filter, the site URL gets included in the href
value:
{{ varWithPhoneNumber|tel('DE')
→ invalid result:
<a href="http://example.test/tel:+49-123-4567879">+49 (0) 123 / 4567879</a>
expected:
<a href="tel:+49-123-4567879">+49 (0) 123 / 4567879</a>
I see from some other issues the field requires [region] and [number] child fields so I can see why feedme might not work but are you planning on supporting or do you know any work arounds?
When creating a new entry, and inputting a phone number into a Phone Number field, when you click "publish entry", coming back to the entry edit page shows the Phone Number field is now blank. I have to input it a 2nd time for it to successfully save, it appears as if it'll only truly save the field until after the entry is "published".
PHP version 7.4.2
MySQL 5.7.26
Craft 3.6.10
Thanks :)!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.