Skip to content

A SilverStripe field type for having an internal or external link *with title*, in a single field with a nicely styled form. Based on the LinkField module by Simon Elvery & Left, Right Centre.

License

Notifications You must be signed in to change notification settings

restruct/silverstripe-namedlinkfield

Repository files navigation

A link field (with title) for SilverStripe

A single inline link field which allows users to set a title/name for the link, and select

  • a page + optional text-anchor from the site tree
  • a file from the assets dir
  • an e-mail address (mailto link)
  • define a custom URL to link to
  • or enter a shortcode
namedlinkfield

Usage

use Restruct\SilverStripe\ORM\FieldType\NamedLinkField;
use Restruct\SilverStripe\Forms\NamedLinkFormField;

...

private static $db = array(
    'NextAction' => NamedLinkField::class,
);

...

public function getCMSFields()
{
    $fields = parent::getCMSFields();

    $fields->insertBefore(
        "Content",
        NamedLinkFormField::create('ActionButton')
    );

    return $fields;
}

TODO

  • Check source-class-HtmlEditorField_Toolbar.html#_LinkForm for inline uploading of files etc
  • Make translatable/i18n

About

A SilverStripe field type for having an internal or external link *with title*, in a single field with a nicely styled form. Based on the LinkField module by Simon Elvery & Left, Right Centre.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 6