2017 © Pedro Peláez
 

silverstripe-vendormodule silverstripe-linkitemfield

SilverStripe 4 custom form element for anchor, email, telephone, file, image, internal and external links

image

cyber-duck/silverstripe-linkitemfield

SilverStripe 4 custom form element for anchor, email, telephone, file, image, internal and external links

  • Monday, January 22, 2018
  • by cyber-duck
  • Repository
  • 3 Watchers
  • 2 Stars
  • 1,513 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 2 Open issues
  • 6 Versions
  • 26 % Grown

The README.md

SilverStripe 4 Link Item Field

Latest Stable Version Latest Unstable Version Total Downloads License, (*1)

Author: Andrew Mc Cormack, (*2)

Features

Provides a has_one Link object with the following options: - Anchor link - Internal Link - External Link - Email - Telephone - File - Image - Link target (_blank etc), (*3)

Screen Shots

Installation

Add the following to your composer.json file and run /dev/buid?flush=all, (*4)

{  
    "require": {  
        "cyber-duck/silverstripe-linkitemfield": "4.1.*"
    }
}

Setup

The field references a has_one LinkItem relation on a DataObject. Make sure to include both the field and object namespaces in your class., (*5)


use CyberDuck\LinkItemField\Forms\LinkItemField; use CyberDuck\LinkItemField\Model\LinkItem; use SilverStripe\ORM\DataObject; class MyObject extends DataObject { private static has_one = [ 'MyRelation' => LinkItem::class ]; }

The field can easily be added to an DataObject / extension through getCMSFields() / updateCMSFields() or similar., (*6)

$fields->addFieldToTab('Root.Main', LinkItemField::create('MyRelationID', 'My Relation Title'));

The relation will expose 3 properties in your template - Link, Title, and Target., (*7)

<% with MyRelation %>
<a href="$Link" target="$Target">$Title</a>
<% end_with %>

When calling Link the outputted URL will be formatted depending on the Link type, (*8)

<a href="#{TheURL}">For Anchor</a>
<a href="{TheURL}">For Internal</a>
<a href="{TheURL}">For External</a>
<a href="mailto:{TheURL}">For Email</a>
<a href="tel:+{TheURL}">For Telephone</a>
<a href="{TheURL}">For File</a>
<a href="{TheURL}">For Image</a>

Todo

  • Add React

The Versions

22/01 2018

dev-master

9999999-dev http://github.com/cyber-duck/silverstripe-linkitemfield

SilverStripe 4 custom form element for anchor, email, telephone, file, image, internal and external links

  Sources   Download

MIT

The Requires

  • php >=5.6

 

silverstripe silverstripe 4 linking custom link field

22/01 2018

dev-develop

dev-develop http://github.com/cyber-duck/silverstripe-linkitemfield

SilverStripe 4 custom form element for anchor, email, telephone, file, image, internal and external links

  Sources   Download

MIT

The Requires

  • php >=5.6

 

silverstripe silverstripe 4 linking custom link field

22/01 2018

4.0.2

4.0.2.0 http://github.com/cyber-duck/silverstripe-linkitemfield

SilverStripe 4 custom form element for anchor, email, telephone, file, image, internal and external links

  Sources   Download

MIT

The Requires

  • php >=5.6

 

silverstripe silverstripe 4 linking custom link field

10/11 2017

4.0.x-dev

4.0.9999999.9999999-dev http://github.com/cyber-duck/silverstripe-linkitemfield

SilverStripe 4 custom form element for anchor, email, telephone, file, image, internal and external links

  Sources   Download

MIT

The Requires

  • php >=5.6

 

silverstripe silverstripe 4 linking custom link field

10/11 2017

4.0.1

4.0.1.0 http://github.com/cyber-duck/silverstripe-linkitemfield

SilverStripe 4 custom form element for anchor, email, telephone, file, image, internal and external links

  Sources   Download

MIT

The Requires

  • php >=5.6

 

silverstripe silverstripe 4 linking custom link field

10/11 2017

4.0.0

4.0.0.0 http://github.com/cyber-duck/silverstripe-linkitemfield

SilverStripe 4 custom form element for anchor, email, telephone, file, image, internal and external links

  Sources   Download

MIT

The Requires

  • php >=5.6

 

silverstripe silverstripe 4 linking custom link field