restruct/silverstripe-namedlinkfield

A SilverStripe composite field for having various link types *with title*, in a single field with a nicely styled form. Based on the LinkField module by Simon Elvery & Left, Right Centre.

Installs: 167

Dependents: 0

Suggesters: 0

Security: 0

Stars: 9

Watchers: 1

Forks: 2

Open Issues: 1

Type:silverstripe-vendormodule

2.0.1 2018-04-27 08:41 UTC

This package is not auto-updated.

Last update: 2020-07-25 06:15:58 UTC


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

Usage

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

...

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

...

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

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

    return $fields;
}

Requirements

  • SilverStripe CMS 4.0 or greater
  • Dependentdropdownfield (for in-page text-anchor selection)

Screenshots

Pick page & text-anchor, file, e-mail or (external) URL. Fields will be auto-updated.

TODO

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