2017 © Pedro Peláez
 

silverstripe-module linkableobjects

Module for SilverStripe allowing Data Objects to be hooked into WYSIWYG link editor.

image

sam-costigan/linkableobjects

Module for SilverStripe allowing Data Objects to be hooked into WYSIWYG link editor.

  • Monday, August 31, 2015
  • by Sam-Costigan
  • Repository
  • 1 Watchers
  • 2 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 4 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

LINKABLE OBJECTS

Maintainer Contact

  • Sam Costigan

Description

Add your custom Data Objects to the HTML Editor Field link functionality, with a Dropdown field that is populated by relevant results as the user searches., (*1)

Requirements

  • SilverStripe 3.0 or newer

Setup

To set up a DataObject to be linkable, first it needs to implement the Linkable interface. There are two requirements for a Linkable DataObject: * a Link() function which will return a relevant URL to display the Data Object. * a LinkTitle() function which will return a title string to display when searching for Data Objects., (*2)

The Link() function will need to return a relevant URL so that the Data Object will be displayed. For more information on how to do this, see http://www.ssbits.com/tutorials/2010/dataobjects-as-pages-part-1-keeping-it-simple/, (*3)

When searching for DataObjects, the $searchable_fields array will be used to decide which fields are searched., (*4)

Example setup

class Test extends DataObject implements Linkable {

    private static $db = array(
        'Name' => 'Text',
        'Author' => 'Varchar(150)'
    );

    public static $searchable_fields = array(
        'Name',
        'Author'
    );

    public function Link() {
        return $this->ID;
    }

    public function LinkTitle() {
        return $this->Name . ' - ' . $this->Author;
    }
}

Once the DataObject has been set up to properly implement the Linkable interface, you need to add the following line to your mysite/_config.php file:, (*5)

HtmlEditorField_LinkObjects::addLinkableObject('Test');, (*6)

Your DataObject will then be added to the HTML Editor Field links section., (*7)

Feedback

Feel free to make this module better by submitting feedback, changes, suggestions etc!, (*8)

The Versions

31/08 2015

dev-master

9999999-dev https://github.com/Sam-Costigan/linkableobjects

Module for SilverStripe allowing Data Objects to be hooked into WYSIWYG link editor.

  Sources   Download

BSD-3-Clause

The Requires

 

by Sam Costigan

silverstripe