zazama/silverstripe-elemental-linkify

A Silverstripe 4 module to create links to elemental elements.

Installs: 5

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:silverstripe-vendormodule

1.0.1 2021-10-10 15:23 UTC

This package is auto-updated.

Last update: 2021-11-10 15:43:30 UTC


README

Packagist Version GitHub

Introduction

silverstripe-elemental-linkify inserts a link type into TinyMCE where you can choose Elemental elements to link to. It also ships with a DBField that inserts a DropdownField into the CMS allowing you to choose both Page links or Elemental links.

Requirements

  • silverstripe/cms ^4.0

This module was only tested on the newest 4.9.0

Installation

composer require zazama/silverstripe-elemental-linkify

Usage TinyMCE

Click on the link type "Element" which will open this window.

It will show a Dropdown with formatting: "[Pagename] Elementname"

TinyMCE

Usage Shortcode Field

<?php

use SilverStripe\ORM\DataObject;
use Zazama\ElementalLinkify\Fields\DBElementalLinkifyShortcode;
use Zazama\ElementalLinkify\Fields\ElementalLinkifyDropdownField;

class Teaser extends DataObject {
    // ...
    private static $db = [
        'TeaserLink' => DBElementalLinkifyShortcode::class
    ];

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

        // TeaserLink will be auto populated, but you can insert the dropdown yourself with
        $fields->addFieldToTab('Root.Something', ElementalLinkifyDropdownField::create('TeaserLink', 'TeaserLink'));

        return $fields;
    }
}

Dropdown