6fdigital/silverstripe-phone-field

A phone number field for the SilverStripe CMS with validation using libphonenumber

Installs: 44

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:silverstripe-vendormodule

v0.1.1 2024-02-16 23:39 UTC

This package is auto-updated.

Last update: 2024-04-17 00:00:19 UTC


README

A phone number field for the SilverStripe CMS with validation using libphonenumber.

Requirements

Installation

composer require "6fdigital/silverstripe-phone-field"

Usage

The PhoneField can be used in your custom forms and with the SilverStripe Userforms module. For usage in your custom Forms simply add the form to your field list:

use SixF\PhoneField\PhoneField;

public function MyForm(): Form {
    return Form::create(
        $this,
        "MyForm",
        FieldList::create(
            ...
            PhoneField::create('PhoneNumber', 'Your Phone Number')
            ...
        ),
        FieldList::create(
            FormAction::create('doSubmit', 'Submit')
        ),
        RequiredFields::create('Phone')
        );
    }
}