2017 © Pedro Peláez
 

silverstripe-module silverstripe-description

Takes form field descriptions through $db_descriptions and shows them in the edit form.

image

svandragt/silverstripe-description

Takes form field descriptions through $db_descriptions and shows them in the edit form.

  • Thursday, April 14, 2016
  • by svandragt
  • Repository
  • 1 Watchers
  • 2 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

silverstripe-description

Takes form field descriptions through $db_descriptions and shows them in the edit form., (*1)

Usage

  1. Install using composer composer require "svandragt/silverstripe-description:*"
  2. Attach it to your data objects / page types through the configuration system as follows:
Object::add_extension("DataObject","DescriptionDataExtension");

DIY Demo:

Course.php:, (*2)

<?php
class Course extends DataObject {
    public static $db = array(
        'Title'             => 'Varchar(500)',
        'IPPCode'           => 'Varchar(20)',
    );

    public static $db_descriptions = array(
        'IPPCode'           => 'Lookup to existing IPP Code if available',
    );    
}

CourseModelAdmin.php:, (*3)

<?php

class CourseModelAdmin extends ModelAdmin {
    public static $managed_models = array(
        'Course',
    ); 
    static $url_segment = 'courses'; // Linked as /admin/products/
    static $menu_title = 'Course Admin';

}

Do a /dev/build and create a new course in the CMS. You will see the IPPCode field has a description below it., (*4)

Screenshot

Example screenshot, (*5)

  1. Unsaved message provided through ManyMessageDataExtension
  2. Styling for required formfields provided through RequiredFieldsCmsDataExtension
  3. Field descriptions automatically linked through DescriptionDataExtension

The Versions

14/04 2016

dev-master

9999999-dev

Takes form field descriptions through $db_descriptions and shows them in the edit form.

  Sources   Download

BSD-3-Clause

The Requires

 

model silverstripe fields descriptions