Takes form field descriptions through $db_descriptions and shows them in the edit form.
- Install using composer
composer require "svandragt/silverstripe-description:*"
- Attach it to your data objects / page types through the configuration system as follows:
Object::add_extension("DataObject","DescriptionDataExtension");
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.
- Unsaved message provided through ManyMessageDataExtension
- Styling for required formfields provided through RequiredFieldsCmsDataExtension
- Field descriptions automatically linked through DescriptionDataExtension