silverstripe-module silverstripe-simple-linkfield
Adds a new simple linkfield fieldtype.
hailwood/silverstripe-simple-linkfield
Adds a new simple linkfield fieldtype.
- Wednesday, January 25, 2017
- by hailwood
- Repository
- 1 Watchers
- 0 Stars
- 17 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 1 Forks
- 1 Open issues
- 3 Versions
- 0 % Grown
Silverstripe Simple Link Field
A Silverstripe Link Field:
, (*1)
-
user defined protocols: Any are supported and depending on the option selected (http, https, or mailto) we'll validate it.
Installation
composer require hailwood/silverstripe-simple-linkfield
Options
TextLinkField:
default_protocols:
http: 'http://'
https: 'https://'
mailto: 'Email'
````
#### Usage
##### Dataobject/Page
```php
class DataObjectWithLink extends DataObject {
protected static $db = [
'Link' => 'Varchar(255)',
'LinkWithoutEmail' => 'Varchar(255)',
];
public function getCMSFields(){
$fields = parent::getCMSFields();
$fields->addFieldsToTab('Root.Main', [
TextLinkField::create('Link', 'Link'),
TextLinkField::create('LinkWithoutEmail')->withoutEmailOption()
]);
return $fields;
}
}
Methods
-
withoutEmailOption(): Quickly disable the default email option
-
withEmailOption($title = 'Email'): Quickly enable or set the title on the default email option
-
setProtocolList([]): Set the local instances protocol list
-
getProtocolList(): Get the list of protocols in use by this local instance
dev-master
9999999-dev
Adds a new simple linkfield fieldtype.
Sources
Download
GNU
The Requires
by
Matthew Hailwood
silverstripe
forms
fields
links
v1.0.0
1.0.0.0
Adds a new simple linkfield fieldtype.
Sources
Download
GNU
The Requires
by
Matthew Hailwood
silverstripe
forms
fields
links
dev-develop
dev-develop
Adds a new simple linkfield fieldtype.
Sources
Download
GNU
The Requires
by
Matthew Hailwood
silverstripe
forms
fields
links