Download the PHP package sunnysideup/silverstripe-externalurlfield without Composer
On this page you can find all versions of the php package sunnysideup/silverstripe-externalurlfield. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sunnysideup/silverstripe-externalurlfield
More information about sunnysideup/silverstripe-externalurlfield
Files in sunnysideup/silverstripe-externalurlfield
Package silverstripe-externalurlfield
Short Description Provides SilverStripe with a DBField and FormField for handling external URLs.
License MIT
Informations about the package silverstripe-externalurlfield
SilverStripe External URL Field
Provides a DBField
and FormField
for handling external URLs.
Validate and tidy urls as they are captured from users. Configuration is highly flexible. Makes use of php's parse_url
and http_build_url
to do the actual work.
Installation
Note - this is forked from sunnysideup/silverstripe-externalurlfield and updated into new composer vendor namespace; making composer installs easier in client projects.
Requirements
Makes use of the http_build_url
function from the PECL pecl_http library. However the module's composer requirements include a PHP fallback/shim/polyfill. The composer replacement does check for the presence of http_build_url
.
- SilverStripe ^4 || ^5
DataObject / Template Usage
Handled by ExternalURL
class (Varchar).
Given the url http://username:[email protected]:81/path?arg=value#anchor
, the above produces:
Form Usage
Handled by ExternalURLField
(FormField).
Validation is handled by the html5 pattern attribute, and also server side by a more robust regular expression.
The field uses the html5 type="url"
attribute.
You can configure various parts of the url to be stripped out, or populated with defaults when missing.
HTML5 validation
Enabled by default, the html5 validation sets the field type atribute to url
, and adds a pattern attribute which is set to https?://.+
.
Disable using the html5validation
config:
Disabling html5 validation is particularly useful if you want to allow users to enter urls that have no scheme/protocol e.g: mywebsite.com
instead of http://www.mywebsite.com
.