zazama/silverstripe-elemental-linkify

A Silverstripe module to create links to elemental elements.

Installs: 46

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:silverstripe-vendormodule

2.0.0 2023-03-20 15:27 UTC

This package is auto-updated.

Last update: 2024-04-16 11:26:42 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 ^5

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