Browse files

MINOR Renaming GridField_Action to GridField_FormAction, to better di…

…stinguish it from GridFieldActionProvider and GridFieldAction_Edit. The two are conceptually related, but not through inheritance, as the original naming suggested.
  • Loading branch information...
1 parent 9517763 commit 3e700d729f8a5836a3db0ddb11f2233f975c2380 @chillu chillu committed Mar 6, 2012
View
5 forms/gridfield/GridField.php
@@ -665,13 +665,14 @@ function handleRequest(SS_HTTPRequest $request, DataModel $model) {
/**
- * 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
2 forms/gridfield/GridFieldAction.php
@@ -163,7 +163,7 @@ public function getActions($gridField) {
* @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
2 forms/gridfield/GridFieldComponent.php
@@ -77,7 +77,7 @@ function getColumnMetadata($gridField, $columnName);
* 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
5 forms/gridfield/GridFieldExporter.php
@@ -39,7 +39,7 @@ public function __construct($exportColumns = null) {
* 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 @@ function getExportColumns() {
*/
function setExportColumns($cols) {
$this->exportColumns = $cols;
+ return $this;
}
/**
@@ -145,6 +146,7 @@ function getCsvSeparator() {
*/
function setCsvSeparator($separator) {
$this->csvSeparator = $separator;
+ return $this;
}
/**
@@ -159,6 +161,7 @@ function getCsvHasHeader() {
*/
function setCsvHasHeader($bool) {
$this->csvHasHeader = $bool;
+ return $this;
}
View
4 forms/gridfield/GridFieldFilter.php
@@ -75,11 +75,11 @@ public function getHTMLFragments($gridField) {
$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
8 forms/gridfield/GridFieldPaginator.php
@@ -99,27 +99,27 @@ public function getHTMLFragments($gridField) {
// 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
4 forms/gridfield/GridFieldRelationAdd.php
@@ -65,9 +65,9 @@ public function getHTMLFragments($gridField) {
$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
2 forms/gridfield/GridFieldRelationDelete.php
@@ -73,7 +73,7 @@ public function getActions($gridField) {
* @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
2 forms/gridfield/GridFieldSortableHeader.php
@@ -29,7 +29,7 @@ public function getHTMLFragments($gridField) {
}
$field = Object::create(
- 'GridField_Action', $gridField, 'SetOrder'.$columnField, $title,
+ 'GridField_FormAction', $gridField, 'SetOrder'.$columnField, $title,
"sort$dir", array('SortColumn' => $columnField)
)->addExtraClass('ss-gridfield-sort');
View
0 templates/Includes/GridField_Action.ss → templates/Includes/GridField_FormAction.ss
File renamed without changes.

0 comments on commit 3e700d7

Please sign in to comment.