restruct/silverstripe-namedlinkfield

A SilverStripe composite field for having various link types *with title*, in a single field with a nicely styled form.

Installs: 1 227

Dependents: 1

Suggesters: 0

Security: 0

Stars: 9

Watchers: 3

Forks: 2

Open Issues: 0

Language:JavaScript

Type:silverstripe-vendormodule


README

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