silverstripe / linkfield
Add advanced link functionality to Silverstripe.
Installs: 24 771
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 9
Forks: 6
Open Issues: 39
Type:silverstripe-vendormodule
Requires
- php: ^7.4 || ^8
- silverstripe/cms: ^4.11
- silverstripe/graphql: ^4
Requires (Dev)
This package is auto-updated.
Last update: 2023-03-09 20:12:11 UTC
README
This module provides a Link model and CMS interface for managing different types of links. Including:
- Emails
- External links
- Links to pages within the CMS
- Links to assets within the CMS
- Phone numbers
Installation
Installation via composer.
GraphQL v4 - Silverstripe 4
composer require silverstripe/linkfield
GraphQL v3 - Silverstripe 4
composer require silverstripe/linkfield:^1
Sample usage
<?php use SilverStripe\CMS\Model\SiteTree; use SilverStripe\LinkField\DBLink; use SilverStripe\LinkField\Link; use SilverStripe\LinkField\LinkField; class Page extends SiteTree { private static array $db = [ 'DbLink' => DBLink::class ]; private static array $has_one = [ 'HasOneLink' => Link::class, ]; public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldsToTab( 'Root.Main', [ LinkField::create('HasOneLink'), LinkField::create('DbLink'), ] ) return $fields; } }
Migrating from Version 1.0.0
or dev-master
Please be aware that in early versions of this module (and in untagged dev-master
) there were no table names defined
for our Link
classes. These have now all been defined, which may mean that you need to rename your old tables, or
migrate the data across.
EG: SilverStripe_LinkField_Models_Link
needs to be migrated to LinkField_Link
.
Migrating from Shae Dawson's Linkable module
https://github.com/sheadawson/silverstripe-linkable
Shae Dawson's Linkable module was a much loved, and much used module. It is, unfortunately, no longer maintained. We have provided some steps and tasks that we hope can be used to migrate your project from Linkable to LinkField.