2017 © Pedro Peláez
 

library slug-field

ATK14 form field for entering slugs

image

atk14/slug-field

ATK14 form field for entering slugs

  • Thursday, June 7, 2018
  • by yarri
  • Repository
  • 2 Watchers
  • 0 Stars
  • 34 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 62 % Grown

The README.md

SlugField

ATK14 form field for entering slugs., (*1)

Usage

In a form:, (*2)

<?php
// file: app/forms/articles/create_new_form.php
class CreateNewForm extends ApplicationForm {

  function set_up(){

    $this->add_field("title", new CharField([
      "label" => "Article title",
      "max_length" => 100, // by default it is either constant SLUG_MAX_LENGTH (if defined) or 65
    ]));

    // ... other article fields

    $this->add_field("slug", new SlugField([
      "label" => "Slug for cool looking url",
      "hint" => "are-you-too-clever-for-success",
      "auto_slugify" => true, // whether to convert automatically something like "Nice Title!" to "nice-title"; default is true
      "max_length" => 100,
    ]));
  }
}

Configuration

Optionally the default value for the max_length option can be set by the constant SLUG_MAX_LENGTH., (*3)

<?php
// file: config/settings.php

// ...

define("SLUG_MAX_LENGTH",100);

Installation

Just use the Composer:, (*4)

cd path/to/your/atk14/project/
composer require atk14/slug-field dev-master

ln -s ../../vendor/atk14/slug-field/src/slug_field.php app/fields/slug_field.php

License

SlugField is free software distributed under the terms of the MIT license, (*5)

The Versions

07/06 2018

dev-master

9999999-dev https://github.com/atk14/SlugField

ATK14 form field for entering slugs

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

field forms slug atk14

07/06 2018

v1.0

1.0.0.0 https://github.com/atk14/SlugField

ATK14 form field for entering slugs

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

field forms slug atk14