Added setDescription() to all fields to test help text support

This support has been added in master, for 3.0 most elements
will simply show the "title" attribute
This commit is contained in:
Ingo Schommer 2012-11-30 12:08:46 +01:00
parent 2cf6e3c242
commit 65d930d829
3 changed files with 33 additions and 3 deletions

View File

@ -115,6 +115,11 @@ class BasicFieldsTestPage extends TestPage {
foreach($tabs as $tab) { foreach($tabs as $tab) {
$tabObj = $fields->fieldByName($tab); $tabObj = $fields->fieldByName($tab);
foreach($tabObj->FieldList() as $field) { foreach($tabObj->FieldList() as $field) {
$field
->setDescription('This is <strong>bold</strong> help text')
->addExtraClass('cms-help');
// ->addExtraClass('cms-help cms-help-tooltip');
$disabledField = $field->performDisabledTransformation(); $disabledField = $field->performDisabledTransformation();
$disabledField->setTitle($disabledField->Title() . ' (disabled)'); $disabledField->setTitle($disabledField->Title() . ' (disabled)');
$disabledField->setName($disabledField->getName() . '_disabled'); $disabledField->setName($disabledField->getName() . '_disabled');

View File

@ -16,17 +16,29 @@ class GridFieldTestPage extends TestPage {
public function getCMSFields() { public function getCMSFields() {
$fields = parent::getCMSFields(); $fields = parent::getCMSFields();
$grids = array();
$config = new GridFieldConfig_RecordEditor(); $config = new GridFieldConfig_RecordEditor();
$grid = new GridField('Companies', 'Companies', new DataList('Company'),$config); $grid = new GridField('Companies', 'Companies', new DataList('Company'),$config);
$fields->addFieldToTab('Root.NoRelation', $grid); $fields->addFieldToTab('Root.NoRelation', $grid);
$grids[] = $grid;
$config = new GridFieldConfig_RelationEditor(); $config = new GridFieldConfig_RelationEditor();
$grid = new GridField('HasManyCompanies', 'HasManyCompanies', $this->HasManyCompanies(),$config); $grid = new GridField('HasManyCompanies', 'HasManyCompanies', $this->HasManyCompanies(),$config);
$fields->addFieldToTab('Root.HasMany', $grid); $fields->addFieldToTab('Root.HasMany', $grid);
$grids[] = $grid;
$config = new GridFieldConfig_RelationEditor(); $config = new GridFieldConfig_RelationEditor();
$grid = new GridField('ManyManyCompanies', 'ManyManyCompanies', $this->ManyManyCompanies(),$config); $grid = new GridField('ManyManyCompanies', 'ManyManyCompanies', $this->ManyManyCompanies(),$config);
$fields->addFieldToTab('Root.ManyMany', $grid); $fields->addFieldToTab('Root.ManyMany', $grid);
$grids[] = $grid;
foreach($grids as $grid) {
$grid
->setDescription('This is <strong>bold</strong> help text')
->addExtraClass('cms-help');
// ->addExtraClass('cms-help cms-help-tooltip');
}
return $fields; return $fields;
} }

View File

@ -22,15 +22,28 @@ class RelationFieldsTestPage extends TestPage {
function getCMSFields() { function getCMSFields() {
$fields = parent::getCMSFields(); $fields = parent::getCMSFields();
$fields->addFieldToTab("Root.CheckboxSet", $allFields = array();
$checkboxFields = array(
new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map()) new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map())
); );
$fields->addFieldsToTab("Root.CheckboxSet", $checkboxFields);
$allFields += $checkboxFields;
$fields->addFieldsToTab('Root.Tree', array( $treeFields = array(
TreeDropdownField::create('HasOnePage', 'HasOnePage', 'SiteTree'), TreeDropdownField::create('HasOnePage', 'HasOnePage', 'SiteTree'),
TreeMultiselectField::create('HasManyPages', 'HasManyPages', 'SiteTree'), TreeMultiselectField::create('HasManyPages', 'HasManyPages', 'SiteTree'),
TreeMultiselectField::create('ManyManyPages', 'ManyManyPages (with search)', 'SiteTree')->setShowSearch(true) TreeMultiselectField::create('ManyManyPages', 'ManyManyPages (with search)', 'SiteTree')->setShowSearch(true)
)); );
$fields->addFieldsToTab('Root.Tree', $treeFields);
$allFields += $treeFields;
foreach($allFields as $field) {
$field
->setDescription('This is <strong>bold</strong> help text')
->addExtraClass('cms-help');
// ->addExtraClass('cms-help cms-help-tooltip');
}
return $fields; return $fields;
} }