MINOR Renaming GridField_Action to GridField_FormAction, to better distinguish it from GridFieldActionProvider and GridFieldAction_Edit. The two are conceptually related, but not through inheritance, as the original naming suggested.

This commit is contained in:
Ingo Schommer 2012-03-06 12:51:57 +01:00
parent 9517763ec6
commit 3e700d729f
10 changed files with 19 additions and 15 deletions

View File

@ -665,13 +665,14 @@ class GridField extends FormField {
/**
* This class is the base class when you want to have an action that alters the state of the gridfield
* This class is the base class when you want to have an action that alters the state of the gridfield,
* rendered as a button element.
*
* @package sapphire
* @subpackage forms
*
*/
class GridField_Action extends FormAction {
class GridField_FormAction extends FormAction {
/**
*

View File

@ -163,7 +163,7 @@ class GridFieldAction_Delete implements GridField_ColumnProvider, GridField_Acti
* @return string - the HTML for the column
*/
public function getColumnContent($gridField, $record, $columnName) {
$field = Object::create('GridField_Action',
$field = Object::create('GridField_FormAction',
$gridField,
'DeleteRecord'.$record->ID,
false,

View File

@ -77,7 +77,7 @@ interface GridField_ColumnProvider extends GridFieldComponent {
* An action is defined by two things: an action name, and zero or more named arguments.
* There is no built-in notion of a record-specific or column-specific action,
* but you may choose to define an argument such as ColumnName or RecordID in order to implement these.
* Does not provide interface elements to call those actions, see {@link GridField_Action}.
* Does not provide interface elements to call those actions, see {@link GridField_FormAction}.
*/
interface GridField_ActionProvider extends GridFieldComponent {
/**

View File

@ -39,7 +39,7 @@ class GridFieldExporter implements GridField_HTMLProvider, GridField_ActionProvi
* Place the export button in a <p> tag below the field
*/
public function getHTMLFragments($gridField) {
$button = new GridField_Action(
$button = new GridField_FormAction(
$gridField,
'export',
_t('TableListField.CSVEXPORT', 'Export to CSV'),
@ -131,6 +131,7 @@ class GridFieldExporter implements GridField_HTMLProvider, GridField_ActionProvi
*/
function setExportColumns($cols) {
$this->exportColumns = $cols;
return $this;
}
/**
@ -145,6 +146,7 @@ class GridFieldExporter implements GridField_HTMLProvider, GridField_ActionProvi
*/
function setCsvSeparator($separator) {
$this->csvSeparator = $separator;
return $this;
}
/**
@ -159,6 +161,7 @@ class GridFieldExporter implements GridField_HTMLProvider, GridField_ActionProvi
*/
function setCsvHasHeader($bool) {
$this->csvHasHeader = $bool;
return $this;
}

View File

@ -75,11 +75,11 @@ class GridFieldFilter implements GridField_HTMLProvider, GridField_DataManipulat
$field = new FieldGroup(
$field,
Object::create('GridField_Action', $gridField, 'filter', false, 'filter', null)
Object::create('GridField_FormAction', $gridField, 'filter', false, 'filter', null)
->addExtraClass('ss-gridfield-button-filter')
->setAttribute('title', _t('GridField.Filter', "Filter"))
,
Object::create('GridField_Action', $gridField, 'reset', false, 'reset', null)
Object::create('GridField_FormAction', $gridField, 'reset', false, 'reset', null)
->addExtraClass('ss-gridfield-button-reset')
->setAttribute('title', _t('GridField.ResetFilter', "Reset"))
);

View File

@ -99,27 +99,27 @@ class GridFieldPaginator implements GridField_HTMLProvider, GridField_DataManipu
// First page button
$firstPage = new GridField_Action($gridField, 'pagination_first', 'First', 'paginate', 1);
$firstPage = new GridField_FormAction($gridField, 'pagination_first', 'First', 'paginate', 1);
$firstPage->addExtraClass('ss-gridfield-firstpage');
if($state->currentPage == 1)
$firstPage = $firstPage->performDisabledTransformation();
// Previous page button
$previousPageNum = $state->currentPage <= 1 ? 1 : $state->currentPage - 1;
$previousPage = new GridField_Action($gridField, 'pagination_prev', 'Previous', 'paginate', $previousPageNum);
$previousPage = new GridField_FormAction($gridField, 'pagination_prev', 'Previous', 'paginate', $previousPageNum);
$previousPage->addExtraClass('ss-gridfield-previouspage');
if($state->currentPage == 1)
$previousPage = $previousPage->performDisabledTransformation();
// Next page button
$nextPageNum = $state->currentPage >= $totalPages ? $totalPages : $state->currentPage + 1;
$nextPage = new GridField_Action($gridField, 'pagination_next', 'Next', 'paginate', $nextPageNum);
$nextPage = new GridField_FormAction($gridField, 'pagination_next', 'Next', 'paginate', $nextPageNum);
$nextPage->addExtraClass('ss-gridfield-nextpage');
if($state->currentPage == $totalPages)
$nextPage = $nextPage->performDisabledTransformation();
// Last page button
$lastPage = new GridField_Action($gridField, 'pagination_last', 'Last', 'paginate', $totalPages);
$lastPage = new GridField_FormAction($gridField, 'pagination_last', 'Last', 'paginate', $totalPages);
$lastPage->addExtraClass('ss-gridfield-lastpage');
if($state->currentPage == $totalPages)
$lastPage = $lastPage->performDisabledTransformation();

View File

@ -65,9 +65,9 @@ class GridFieldRelationAdd implements GridField_HTMLProvider, GridField_ActionPr
$searchField->setAttribute('placeholder', $this->getPlaceholderText($dataClass));
$searchField->addExtraClass('relation-search');
$findAction = new GridField_Action($gridField, 'gridfield_relationfind', _t('GridField.Find', "Find"), 'find', 'find');
$findAction = new GridField_FormAction($gridField, 'gridfield_relationfind', _t('GridField.Find', "Find"), 'find', 'find');
$findAction->setAttribute('data-icon', 'relationfind');
$addAction = new GridField_Action($gridField, 'gridfield_relationadd', _t('GridField.LinkExisting', "Link Exisiting"), 'addto', 'addto');
$addAction = new GridField_FormAction($gridField, 'gridfield_relationadd', _t('GridField.LinkExisting', "Link Exisiting"), 'addto', 'addto');
$addAction->setAttribute('data-icon', 'chain--plus');
// If an object is not found, disable the action

View File

@ -73,7 +73,7 @@ class GridFieldRelationDelete implements GridField_ColumnProvider, GridField_Act
* @return string - the HTML for the column
*/
public function getColumnContent($gridField, $record, $columnName) {
$field = Object::create('GridField_Action',
$field = Object::create('GridField_FormAction',
$gridField,
'UnlinkRelation'.$record->ID,
false,

View File

@ -29,7 +29,7 @@ class GridFieldSortableHeader implements GridField_HTMLProvider, GridField_DataM
}
$field = Object::create(
'GridField_Action', $gridField, 'SetOrder'.$columnField, $title,
'GridField_FormAction', $gridField, 'SetOrder'.$columnField, $title,
"sort$dir", array('SortColumn' => $columnField)
)->addExtraClass('ss-gridfield-sort');