2011-12-06 01:56:24 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base interface for all components that can be added to GridField.
|
|
|
|
*/
|
2012-03-06 12:39:13 +01:00
|
|
|
interface GridFieldComponent {
|
2011-12-06 01:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A GridField manipulator that provides HTML for the header/footer rows, or for before/after the template
|
|
|
|
*/
|
|
|
|
interface GridField_HTMLProvider extends GridFieldComponent {
|
2012-03-06 12:39:13 +01:00
|
|
|
|
2011-12-06 01:56:24 +01:00
|
|
|
/**
|
2012-03-08 07:04:07 +01:00
|
|
|
* Returns a map where the keys are fragment names and the values are pieces of HTML to add to these fragments.
|
|
|
|
*
|
|
|
|
* Here are 4 built-in fragments: 'header', 'footer', 'before', and 'after', but components may also specify
|
|
|
|
* fragments of their own.
|
|
|
|
*
|
|
|
|
* To specify a new fragment, specify a new fragment by including the text "$DefineFragment(fragmentname)" in the
|
|
|
|
* HTML that you return. Fragment names should only contain alphanumerics, -, and _.
|
|
|
|
*
|
|
|
|
* If you attempt to return HTML for a fragment that doesn't exist, an exception will be thrown when the GridField
|
|
|
|
* is rendered.
|
|
|
|
*
|
2012-03-06 12:39:13 +01:00
|
|
|
* @return Array
|
2011-12-06 01:56:24 +01:00
|
|
|
*/
|
|
|
|
function getHTMLFragments($gridField);
|
|
|
|
}
|
2012-03-06 12:39:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a new column to the table display body, or modify existing columns.
|
|
|
|
* Used once per record/row.
|
|
|
|
*/
|
2011-12-06 01:56:24 +01:00
|
|
|
interface GridField_ColumnProvider extends GridFieldComponent {
|
2012-03-06 12:39:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Modify the list of columns displayed in the table.
|
2012-03-09 02:07:40 +01:00
|
|
|
* See {@link GridField->getDisplayFields()} and {@link GridFieldDataColumns}.
|
2012-03-06 12:39:13 +01:00
|
|
|
*
|
|
|
|
* @param GridField
|
|
|
|
* @param Array List reference of all column names.
|
|
|
|
*/
|
2011-12-06 01:56:24 +01:00
|
|
|
function augmentColumns($gridField, &$columns);
|
2012-03-06 12:39:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Names of all columns which are affected by this component.
|
|
|
|
*
|
|
|
|
* @param GridField
|
|
|
|
* @return Array
|
|
|
|
*/
|
2011-12-06 01:56:24 +01:00
|
|
|
function getColumnsHandled($gridField);
|
2012-03-06 12:39:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* HTML for the column, content of the <td> element.
|
|
|
|
*
|
|
|
|
* @param GridField
|
|
|
|
* @param DataObject Record displayed in this row
|
|
|
|
* @param String
|
|
|
|
* @return String HTML for the column. Return NULL to skip.
|
|
|
|
*/
|
2011-12-06 01:56:24 +01:00
|
|
|
function getColumnContent($gridField, $record, $columnName);
|
2012-03-06 12:39:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Attributes for the element containing the content returned by {@link getColumnContent()}.
|
|
|
|
*
|
|
|
|
* @param GridField
|
|
|
|
* @param DataObject Record displayed in this row
|
|
|
|
* @param String
|
|
|
|
* @return Array
|
|
|
|
*/
|
2011-12-06 01:56:24 +01:00
|
|
|
function getColumnAttributes($gridField, $record, $columnName);
|
2012-03-06 12:39:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Additional metadata about the column which can be used by other components,
|
|
|
|
* e.g. to set a title for a search column header.
|
|
|
|
*
|
|
|
|
* @param GridField
|
|
|
|
* @param String
|
|
|
|
* @return Array Map of arbitrary metadata identifiers to their values.
|
|
|
|
*/
|
2011-12-06 01:56:24 +01:00
|
|
|
function getColumnMetadata($gridField, $columnName);
|
|
|
|
}
|
2012-03-06 12:39:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
2012-03-06 12:51:57 +01:00
|
|
|
* Does not provide interface elements to call those actions, see {@link GridField_FormAction}.
|
2012-03-06 12:39:13 +01:00
|
|
|
*/
|
2011-12-06 01:56:24 +01:00
|
|
|
interface GridField_ActionProvider extends GridFieldComponent {
|
|
|
|
/**
|
2012-03-06 12:39:13 +01:00
|
|
|
* Return a list of the actions handled by this action provider.
|
|
|
|
* Used to identify the action later on through the $actionName parameter in {@link handleAction}.
|
|
|
|
* There is no namespacing on these actions, so you need to ensure that they don't conflict with other components.
|
|
|
|
*
|
|
|
|
* @param GridField
|
|
|
|
* @return Array with action identifier strings.
|
2011-12-06 01:56:24 +01:00
|
|
|
*/
|
|
|
|
function getActions($gridField);
|
|
|
|
|
|
|
|
/**
|
2012-03-06 12:39:13 +01:00
|
|
|
* Handle an action on the given grid field.
|
|
|
|
* Calls ALL components for every action handled, so the component
|
|
|
|
* needs to ensure it only accepts actions it is actually supposed to handle.
|
|
|
|
*
|
|
|
|
* @param GridField
|
|
|
|
* @param String Action identifier, see {@link getActions()}.
|
|
|
|
* @param Array Arguments relevant for this
|
|
|
|
* @param Array All form data
|
2011-12-06 01:56:24 +01:00
|
|
|
*/
|
|
|
|
function handleAction(GridField $gridField, $actionName, $arguments, $data);
|
|
|
|
}
|
2012-03-06 12:39:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Can modify the data list.
|
|
|
|
* For example, a paginating component can apply a limit, or a sorting component can apply a sort.
|
|
|
|
* Generally, the data manipulator will make use of to `GridState` variables to decide
|
|
|
|
* how to modify the data list (see {@link GridState}).
|
|
|
|
*/
|
2011-12-06 01:56:24 +01:00
|
|
|
interface GridField_DataManipulator extends GridFieldComponent {
|
|
|
|
/**
|
|
|
|
* Manipulate the datalist as needed by this grid modifier.
|
2012-03-06 12:39:13 +01:00
|
|
|
*
|
|
|
|
* @param GridField
|
|
|
|
* @param SS_List
|
|
|
|
* @return DataList
|
2011-12-06 01:56:24 +01:00
|
|
|
*/
|
|
|
|
function getManipulatedData(GridField $gridField, SS_List $dataList);
|
2012-01-09 06:47:31 +01:00
|
|
|
}
|
|
|
|
|
2012-03-06 12:39:13 +01:00
|
|
|
/**
|
|
|
|
* Sometimes an action isn't enough: you need to provide additional support URLs for the grid.
|
|
|
|
* These URLs may return user-visible content, for example a pop-up form for editing a record's details,
|
|
|
|
* or they may be support URLs for front-end functionality.
|
|
|
|
* For example a URL that will return JSON-formatted data for a javascript grid control.
|
|
|
|
*/
|
2012-01-09 06:47:31 +01:00
|
|
|
interface GridField_URLHandler extends GridFieldComponent {
|
|
|
|
/**
|
|
|
|
* Return URLs to be handled by this grid field, in an array the same form as $url_handlers.
|
|
|
|
* Handler methods will be called on the component, rather than the grid field.
|
|
|
|
*/
|
|
|
|
function getURLHandlers($gridField);
|
2011-12-06 01:56:24 +01:00
|
|
|
}
|