Fix requirements being inconsistently included.

This commit is contained in:
ajshort 2013-02-09 01:42:48 +11:00
parent f62493ffa9
commit c10810c3f6
5 changed files with 17 additions and 5 deletions

View File

@ -17,8 +17,7 @@ class GridFieldAddExistingSearchButton implements
}
public function getHTMLFragments($grid) {
Requirements::css('gridfieldextensions/css/GridFieldExtensions.css');
Requirements::javascript('gridfieldextensions/javascript/GridFieldExtensions.js');
GridFieldExtensions::include_requirements();
$data = new ArrayData(array(
'Link' => $grid->Link('add-existing-search')

View File

@ -135,6 +135,8 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL
return array();
}
GridFieldExtensions::include_requirements();
$field = new DropdownField(sprintf('%s[ClassName]', __CLASS__), '', $classes);
$field->setEmptyString(_t('GridFieldExtensions.SELECTTYPETOCREATE', '(Select type to create)'));
$field->addExtraClass('no-change-track');

View File

@ -45,6 +45,7 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements
}
public function getHTMLFragments($grid) {
GridFieldExtensions::include_requirements();
$grid->addExtraClass('ss-gridfield-editable');
}

View File

@ -0,0 +1,12 @@
<?php
/**
* Utility functions for the grid fields extension module.
*/
class GridFieldExtensions {
public static function include_requirements() {
Requirements::css('gridfieldextensions/css/GridFieldExtensions.css');
Requirements::javascript('gridfieldextensions/javascript/GridFieldExtensions.js');
}
}

View File

@ -86,9 +86,7 @@ class GridFieldOrderableRows extends RequestHandler implements
}
public function getHTMLFragments($field) {
Requirements::css('gridfieldextensions/css/GridFieldExtensions.css');
Requirements::javascript('gridfieldextensions/javascript/GridFieldExtensions.js');
GridFieldExtensions::include_requirements();
$field->addExtraClass('ss-gridfield-orderable');
}