Skip to content

Commit

Permalink
Allow emergency numbers such as 911 and 111 as valid phone numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
scott1702 committed Sep 23, 2022
1 parent 86375f2 commit cbe61f0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Models/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
namespace Sheadawson\Linkable\Models;

use SilverStripe\Assets\File;
use SilverStripe\Forms\DropdownField;
use SilverStripe\Core\Convert;
use SilverStripe\Forms\CheckboxField;
use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\TreeDropdownField;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\FieldType\DBHTMLText;
use UncleCheese\DisplayLogic\Forms\Wrapper;
use SilverStripe\Core\Convert;
use SilverStripe\ORM\ValidationResult;
use SilverStripe\ORM\DataObject;
use UncleCheese\DisplayLogic\Forms\Wrapper;

/**
* Class Link
Expand Down Expand Up @@ -529,7 +529,7 @@ public function validate()

break;
case 'Phone':
if (!preg_match("/^\+?[0-9]{1,5}[- ]{0,1}[0-9]{3,4}[- ]{0,1}[0-9]{4}$/", $this->Phone)) {
if (!preg_match("/^([0-9]{3}|\+?[0-9]{1,5}[- ]{0,1}[0-9]{3,4}[- ]{0,1}[0-9]{4})$/", $this->Phone)) {
$valid = false;
$message = _t(
'Linkable.VALIDATIONERROR_VALIDPHONE',
Expand Down

0 comments on commit cbe61f0

Please sign in to comment.