2017 © Pedro Peláez
 

silverstripe-vendormodule segment-field

A reusable approach to segment-generating fields

image

silverstripe/segment-field

A reusable approach to segment-generating fields

  • Monday, June 18, 2018
  • by assertchris
  • Repository
  • 9 Watchers
  • 7 Stars
  • 151,130 Installations
  • PHP
  • 5 Dependents
  • 0 Suggesters
  • 12 Forks
  • 0 Open issues
  • 12 Versions
  • 9 % Grown

The README.md

SilverStripe Segment Field

Build Status SilverStripe supported module Code Quality Codecov Version License, (*1)

A reusable approach to segment-generating fields., (*2)

Usage

use SilverStripe\Forms\SegmentField;
use SilverStripe\Forms\SegmentFieldModifier\SlugSegmentFieldModifier;
use SilverStripe\Forms\SegmentFieldModifier\IDSegmentFieldModifier;

SegmentField::create('PageName')->setModifiers(array(
    SlugSegmentFieldModifier::create()->setDefault('page'),
    array('-', ''),
    IDSegmentFieldModifier::create(),
))->setPreview($this->PageDisplayName)
  1. Starting with a value of "My New Page!".
  2. The value is passed through SlugSegmentFieldModifier.
  3. Preview value becomes "My-New-Page", Input value becomes "My-New-Page".
  4. The value is passed through array('-', '').
  5. Preview value becomes "My-New-Page-", Input value becomes "My-New-Page".
  6. The value is passed through IDSegmentFieldModifier.
  7. Preview value becomes "My-New-Page-1" (with the DataObject ID), Input value becomes "My-New-Page".

You can pass any similarly structured array or implementation of SilverStripe\Forms\SegmentFieldModifier in the modifiers list., (*3)

Using on the frontend

This field is primarily designed for use within the SilverStripe CMS. If you want to use it on the frontend, please ensure that you have included your own version of jQuery and the jQuery entwine library that ships with the silverstripe/admin module, for example:, (*4)

Requirements::javascript('//code.jquery.com/jquery-3.3.1.min.js');
Requirements::javascript('silverstripe/admin:thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');

These dependencies are included by default when using this field within the CMS., (*5)

Versioning

This library follows Semver. According to Semver, you will be able to upgrade to any minor or patch version of this library without any breaking changes to the public API. Semver also requires that we clearly define the public API for this library., (*6)

All methods, with public visibility, are part of the public API. All other methods are not part of the public API. Where possible, we'll try to keep protected methods backwards-compatible in minor/patch versions, but if you're overriding methods then please test your work before upgrading., (*7)

Thanks

I'd like to thank SilverStripe for letting me work on fun projects like this. Feel free to talk to me about using the framework and CMS or working at SilverStripe., (*8)

The Versions

18/06 2018

dev-master

9999999-dev

A reusable approach to segment-generating fields

  Sources   Download

MIT

The Requires

 

The Development Requires

silverstripe segment

25/05 2018

2.2.x-dev

2.2.9999999.9999999-dev

A reusable approach to segment-generating fields

  Sources   Download

MIT

The Requires

 

The Development Requires

silverstripe segment

25/05 2018
18/02 2018

2.2.1

2.2.1.0

A reusable approach to segment-generating fields

  Sources   Download

MIT

The Requires

 

The Development Requires

silverstripe segment

18/02 2018

2.1.1

2.1.1.0

A reusable approach to segment-generating fields

  Sources   Download

MIT

The Requires

 

The Development Requires

silverstripe segment

26/10 2017

2.2.0

2.2.0.0

A reusable approach to segment-generating fields

  Sources   Download

MIT

The Requires

 

The Development Requires

silverstripe segment

01/02 2017

2.0.0

2.0.0.0

A reusable approach to segment-generating fields

  Sources   Download

MIT

The Requires

 

The Development Requires

silverstripe segment

18/08 2015

1.0.3

1.0.3.0

A reusable approach to segment-generating fields

  Sources   Download

MIT

The Requires

 

The Development Requires

silverstripe segment

12/08 2015

1.0.2

1.0.2.0

A reusable approach to segment-generating fields

  Sources   Download

MIT

The Requires

 

The Development Requires

silverstripe segment

11/08 2015

1.0.1

1.0.1.0

A reusable approach to segment-generating fields

  Sources   Download

MIT

The Development Requires

silverstripe segment

11/08 2015

1.0.0

1.0.0.0

A reusable approach to segment-generating fields

  Sources   Download

MIT

The Development Requires

silverstripe segment