Created
April 7, 2017 08:17
-
-
Save sommereder/a3d5f071eba7fa0c31d808bd7f9578a3 to your computer and use it in GitHub Desktop.
Gimme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Gimme { | |
static function aGridField($__name, $__label, $__storage, $__numItemsPerPage = 32) { | |
$_gridFieldConfig = Gimme::getGridFieldConfig($__numItemsPerPage); | |
return new GridField($__name, $__label, $__storage, $_gridFieldConfig); | |
} | |
static function aSortableGridField($__name, $__label, $__storage, $__numItemsPerPage = 32) { | |
$_gridFieldConfig = Gimme::getGridFieldConfig($__numItemsPerPage); | |
$_gridFieldConfig->addComponent(new GridFieldSortableRows('SortID')); | |
return new GridField($__name, $__label, $__storage, $_gridFieldConfig); | |
} | |
static function getGridFieldConfig($__numItemsPerPage) { | |
$_gridFieldConfig = GridFieldConfig::create(); | |
$_gridFieldConfig->addComponents( | |
new GridFieldToolbarHeader(), | |
new GridFieldSortableHeader(), | |
new GridFieldDetailForm(), | |
new GridFieldAddNewButton('toolbar-header-right'), | |
new GridFieldDataColumns(), | |
new GridFieldFilterHeader(), | |
new GridFieldViewButton(), | |
new GridFieldEditButton(), | |
new GridFieldDeleteAction(), | |
new GridFieldPaginator($__numItemsPerPage) | |
); | |
return $_gridFieldConfig; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment