2017 © Pedro Peláez
 

silverstripe-module silverstripe-flexilink

Link to SiteTree Pages, External URLs, YouTube Videos, &c. from a single, flexible SilverStripe field.

image

briceburg/silverstripe-flexilink

Link to SiteTree Pages, External URLs, YouTube Videos, &c. from a single, flexible SilverStripe field.

  • Thursday, January 29, 2015
  • by briceburg
  • Repository
  • 0 Watchers
  • 6 Stars
  • 218 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 1 Forks
  • 5 Open issues
  • 2 Versions
  • 4 % Grown

The README.md

silverstripe-flexilink

Link to SiteTree Pages, External URLs, YouTube Videos, &c. from a single, flexible SilverStripe field., (*1)

Requirements

SilverStripe 3+, (*2)

Screenshots

flexichoice field, (*3)

See silverstripe-flexichoice for a similar text input field., (*4)

Usage

  • Add FlexiLink field types to your DataObject(s)
class BlockContentHeading extends DataObject {
  private static $db = array(
    'Title'     => 'Varchar',
    'Content'   => 'Text',
    'Link'      => 'FlexiLink',   // <--- here
    'LinkText'  => 'FlexiChoice', 
  );

Trigger the environment builder (/dev/build) after extending objects -- You will now see the FlexiLinkField appear in the CMS when editing your object., (*5)

  • FlexiLink provides the following public template methods
    • Type : The type of link (e.g. 'ExternalURL','Page','YouTubeID')
    • Value : The raw value of the link
    • URL : The link transformed into a URL (E.g. Page->Link(), 'http://www.google.com/', '//www.youtube.com/embed/[Value]')


$Title

$Content
  • You may define link selection types and their related fields in YAML Configuration. Here's an example /mysite/config/_config.yml
---
Name: mysite
After:
  - 'framework/*'
  - 'cms/*'
---
# YAML configuration for SilverStripe
# See http://doc.silverstripe.org/framework/en/topics/configuration
# Caution: Indentation through two spaces, not tabs
SSViewer:
  theme: 'site'

FlexiLinkField:
  allowed_types:
    - Page
    - Google

  field_types:
    Google:
      field: TextField
      description: TestTest

This example adds a custom 'Google' field type, and limits the dropdown selection to 'Page' and 'Google' (hides the built-in YouTubeID and ExternalURL)., (*6)

Remember, ?flush=all after YML configuration changes to register them in the manifest., (*7)

The Versions

29/01 2015

dev-master

9999999-dev https://github.com/briceburg/silverstripe-flexilink

Link to SiteTree Pages, External URLs, YouTube Videos, &c. from a single, flexible SilverStripe field.

  Sources   Download

BSD-3-Clause

The Requires

 

by Brice Burgess

url cms page silverstripe link field video external youtube selection sitetree

28/01 2015

0.1.0

0.1.0.0 https://github.com/briceburg/silverstripe-flexilink

Link to SiteTree Pages, External URLs, YouTube Videos, &c. from a single, flexible SilverStripe field.

  Sources   Download

BSD-3-Clause

The Requires

 

by Brice Burgess

url cms page silverstripe link field video external youtube selection sitetree