GridViewsController
extends AppController
in package
JSON-based REST endpoints for managing saved grid views.
Provides CRUD operations for user grid views, default management, and view resolution. All actions return JSON and are called via AJAX from the grid-view Stimulus controller. Authorization handled via service layer based on member ownership.
Table of Contents
Constants
- VIEW_DATA_EVENT = 'KMP.plugins.callForViewData'
- VIEW_PLUGIN_EVENT = 'KMP.plugins.callForViewCells'
Properties
- $gridViewService : GridViewService
- Grid view service
- $isCsvRequest : bool
- $pluginViewCells : array<string|int, mixed>
Methods
- add() : void
- Create a new grid view
- beforeFilter() : Response|null
- Before filter callback
- clearDefault() : void
- Clear the user's default for a grid
- delete() : void
- Delete a grid view
- edit() : void
- Update an existing grid view
- effective() : void
- Get effective view for a grid based on priority resolution
- index() : void
- List all views available for a grid
- initialize() : void
- Initialize controller
- isCsvRequest() : bool
- Check if current request is for CSV export.
- setDefault() : void
- Set a view as the user's default for a grid (supports user or system views)
- switchView() : Response
- Switch between mobile and desktop view modes.
- authorizeCurrentUrl() : void
- Authorize the current URL/action via Authorization component.
- organizeViewCells() : array<string|int, mixed>
- Organize view cells by type and display order.
Constants
VIEW_DATA_EVENT
public
string
VIEW_DATA_EVENT
= 'KMP.plugins.callForViewData'
Event for plugin view data enhancement
VIEW_PLUGIN_EVENT
public
string
VIEW_PLUGIN_EVENT
= 'KMP.plugins.callForViewCells'
Event for plugin view cell registration
Properties
$gridViewService
Grid view service
protected
GridViewService
$gridViewService
$isCsvRequest
protected
bool
$isCsvRequest
= false
Whether current request is for CSV export (.csv extension)
$pluginViewCells
protected
array<string|int, mixed>
$pluginViewCells
= []
View cells from plugins for current request
Methods
add()
Create a new grid view
public
add() : void
beforeFilter()
Before filter callback
public
beforeFilter(EventInterface $event) : Response|null
Parameters
- $event : EventInterface
-
Event
Return values
Response|nullclearDefault()
Clear the user's default for a grid
public
clearDefault() : void
delete()
Delete a grid view
public
delete(int $id) : void
Parameters
- $id : int
-
View ID
edit()
Update an existing grid view
public
edit(int $id) : void
Parameters
- $id : int
-
View ID
effective()
Get effective view for a grid based on priority resolution
public
effective() : void
index()
List all views available for a grid
public
index() : void
Returns system defaults and the current user's views for the specified grid.
initialize()
Initialize controller
public
initialize() : void
isCsvRequest()
Check if current request is for CSV export.
public
isCsvRequest() : bool
Return values
boolsetDefault()
Set a view as the user's default for a grid (supports user or system views)
public
setDefault([string|int|null $id = null ]) : void
Parameters
- $id : string|int|null = null
-
View identifier from the route (optional)
switchView()
Switch between mobile and desktop view modes.
public
switchView() : Response
Stores preference in session and redirects to appropriate interface. Mobile redirects to viewMobileCard, desktop to profile.
Return values
Response —Redirect response
authorizeCurrentUrl()
Authorize the current URL/action via Authorization component.
protected
authorizeCurrentUrl() : void
Tags
organizeViewCells()
Organize view cells by type and display order.
protected
organizeViewCells(array<string|int, mixed> $viewCells) : array<string|int, mixed>
Unused - view cells organized in ViewCellRegistry
Parameters
- $viewCells : array<string|int, mixed>
-
Flat array of view cell configurations
Return values
array<string|int, mixed> —Organized array grouped by type and sorted by order