2017 © Pedro Peláez
 

silverstripe-vendormodule silverstripe-text-target-length

Set character length recommendations on SilverStripe text form fields

image

jonom/silverstripe-text-target-length

Set character length recommendations on SilverStripe text form fields

  • Monday, May 28, 2018
  • by Jono M
  • Repository
  • 2 Watchers
  • 30 Stars
  • 7,299 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 13 Forks
  • 5 Open issues
  • 8 Versions
  • 21 % Grown

The README.md

Text Target Length for Silverstripe CMS

Character limits in action, (*1)

If you see a field marked 'Description' you know roughly what type of content to put in there. But how do you know how much of it to write? A single sentence might do, but maybe a paragraph or more is required? A great content plan should recommend an ideal length for every type of content, so content authors and designers alike can make informed decisions., (*2)

This module extends the TextField, TextareaField and HTMLEditorField classes in Silverstripe to allow you to set a recommended content length, and set soft upper and lower limits on character count., (*3)

Requirements

Silverstripe 4|5 (3.1+ in previous releases), (*4)

Installation

composer require jonom/silverstripe-text-target-length, (*5)

Packagist listing, (*6)

How to use

With the module installed you can call call setTargetLength() on TextField, TextareaField and HTMLEditorField form fields., (*7)

// Ideal length: 100 characters
// Minimum: 75 (automatically set at 75% of ideal)
// Maximum: 125 (automatically set at 125% of ideal)
$field->setTargetLength(100);

// Ideal length: 100 characters
// Minimum: 25
// Maximum: 150
$field->setTargetLength(100, 25, 150);

// Prefer to think in word count?
// 6 characters per word works okay for English
$field->setTargetLength(50*6);

Customise hint text

This module supports translation through yml, so if you want to change the hint text that is displayed when users are typing, just create your own language file to override the one included in the module., (*8)

Front-end use

If you want to use this module outside of the CMS, you will need to load a copy of jQuery and jQuery Entwine in to the page. Example:, (*9)

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

Maintainer contact

Jono Menz, (*10)

Sponsorship

If you want to boost morale of the maintainer you're welcome to make a small monthly donation through GitHub, or a one time donation through PayPal. ❤️ Thank you!, (*11)

Please also feel free to get in touch if you want to hire the maintainer to develop a new feature, or discuss another opportunity., (*12)

The Versions

28/05 2018

dev-master

9999999-dev

Set character length recommendations on SilverStripe text form fields

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe target textfield textareafield

28/05 2018

2.0.2

2.0.2.0

Set character length recommendations on SilverStripe text form fields

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe target textfield textareafield

11/04 2018

2.0.1

2.0.1.0

Set character length recommendations on SilverStripe text form fields

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe target textfield textareafield

30/01 2018

2.0.0

2.0.0.0

Set character length recommendations on SilverStripe text form fields

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe target textfield textareafield

30/03 2017

1.0.1

1.0.1.0

Set character length recommendations on SilverStripe text form fields

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe target textfield textareafield

09/01 2017

1.0.0

1.0.0.0

Set character length recommendations on SilverStripe text form fields

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe target textfield textareafield

11/03 2016

0.2

0.2.0.0

Set character length recommendations on SilverStripe text form fields

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe target textfield textareafield

10/03 2016

0.1

0.1.0.0

Set character length recommendations on SilverStripe text form fields

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe target textfield textareafield