ilateral\SilverStripe\ModelAdminPlus\GridFieldDateFinder
Helper class designed to find date fields in a provided `GridField` and convert them to a nice format (while maintaining sorting)
Synopsis
class GridFieldDateFinder
{
- // members
- protected GridField $grid_field;
- protected $date_type;
- private static string $default_date_type = ".Nice";
- // methods
- public void __construct()
- public GridFieldDateFinder convertDateFields()
- public array findDateFields()
- public static boolean isColumnProvider()
- public array changeKeys()
- public GridField getGridField()
- public GridFieldDateFinder setGridField()
- public string getDateType()
- public GridFieldDateFinder setDateType()
Hierarchy
Uses
- SilverStripe\Core\Injector\Injectable
- SilverStripe\Core\Config\Configurable
Members
private
- $default_date_type
—
string
The date formatting method to use (this corresponds to a Date method on the Date/DateTime data type).
protected
- $date_type
—
string
Overwrite the date format (provided by config) for this instance - $grid_field
—
SilverStripe\Forms\GridField\GridField
`GridField` we are working with
Methods
public
- __construct()
- changeKeys() — Change the array keys on the provided array to the provided alternative (thanks to: https://stackoverflow.com/a/14227644/4161644)
- convertDateFields() — Get any date fields from the passed list and convert to .Nice format.
- findDateFields() — Create an array of fields, titles and values that we use to setup sortable fields in the following format:
- getDateType() — Get for this instance
- getGridField() — Get `GridField` we are working with
- isColumnProvider() — Is the provided component a `GridField_ColumnProvider`?
- setDateType() — Set for this instance
- setGridField() — Set `GridField` we are working with