Skip to content
This repository was archived by the owner on Jan 3, 2018. It is now read-only.

svandragt/silverstripe-description

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

silverstripe-description

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

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:

<?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:

<?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.

Screenshot

Example screenshot

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

About

Autopopulate field descriptions to form fields

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages