GatheringsController
extends AppController
in package
uses
DataverseGridTrait
Gatherings Controller
Manages gatherings (events) with activity selection and waiver tracking. Enables gathering stewards to create gatherings with basic information and automatically determines required waivers based on selected activities.
Table of Contents
Constants
- VIEW_DATA_EVENT = 'KMP.plugins.callForViewData'
- VIEW_PLUGIN_EVENT = 'KMP.plugins.callForViewCells'
Properties
- $Gatherings : GatheringsTable
- $inject : array<string|int, string>
- Service dependency injection configuration
- $isCsvRequest : bool
- $pluginViewCells : array<string|int, mixed>
Methods
- add() : Response|null|void
- Add method
- addActivity() : Response|null
- Add Activity method
- addScheduledActivity() : Response|null
- Add scheduled activity
- allGatherings() : Response|null|void
- All gatherings method - Filtered gathering listing with export capability
- attendanceModal() : void
- Attendance Modal - Returns the attendance modal content for AJAX loading
- beforeFilter() : Response|null|void
- Before filter callback
- calendar() : Response|null|void
- Calendar view method
- calendarGridData() : Response|null
- Dataverse grid data provider for calendar layout
- cancel() : Response|null
- Cancel method
- clone() : Response|null
- Clone method
- delete() : Response|null
- Delete method
- deleteScheduledActivity() : Response|null
- Delete scheduled activity
- downloadCalendar() : Response
- Download calendar file for a gathering
- edit() : Response|null|void
- Edit method
- editActivityDescription() : Response|null
- Edit Activity Description method
- editScheduledActivity() : Response|null
- Edit scheduled activity
- feed() : Response
- Public iCalendar subscription feed.
- gridData() : Response|null
- Grid Data provider for gatherings index dv_grid
- index() : Response|null|void
- Index method
- initialize() : void
- Initialize controller
- isCsvRequest() : bool
- Check if current request is for CSV export.
- mobileCalendar() : Response|null|void
- Mobile calendar view
- mobileCalendarData() : Response
- Mobile calendar data endpoint
- paginate() : array<string|int, Gathering>|ResultSetInterface
- publicLanding() : Response|null|void
- Public landing page for a gathering
- quickView() : Response|null|void
- Quick view method for calendar modal
- removeActivity() : Response|null
- Remove Activity method
- switchView() : Response
- Switch between mobile and desktop view modes.
- uncancel() : Response|null
- Uncancel method
- view() : Response|null|void
- View method
- addConditions() : Query
- Add conditions - Optimize gathering queries for performance and security
- applyCustomFilterHandlers() : SelectQuery
- Apply custom filter handlers for columns with complex filtering logic
- authorizeCurrentUrl() : void
- Authorize the current URL/action via Authorization component.
- buildDataverseGridState() : array<string|int, mixed>
- Build complete grid state object (single source of truth)
- buildExportDataFromEntities() : array<string|int, mixed>
- Build export data from pre-processed entities (Data Mode)
- buildExportDataFromQuery() : array<string|int, mixed>
- Build export data from database query (Query Mode)
- buildGatheringSystemViewQueryCallback() : callable
- Build query callback for temporal system views
- extractExportValue() : string
- Extract export value from entity using column metadata
- extractFilterFromExpression() : mixed
- Recursively extract a filter value from an expression tree
- extractFilterFromSystemView() : mixed
- Extract a specific filter value from a system view configuration
- extractFilterFromViewConfig() : mixed
- Extract a specific filter value from a saved user view's config
- extractFilterGrouping() : array<string|int, mixed>
- Extract filter grouping information from expression tree
- extractSystemViewDefaults() : array{filters: array, dateRange: array, search: ?string, skipFilterColumns: array}
- Extract default filters/search metadata for a system view configuration
- formatExportValue() : string
- Format value for CSV export
- handleCsvExport() : Response
- Handle CSV export from grid result
- isCsvExportRequest() : bool
- Check if the current request is for CSV export
- loadFilterOptions() : array<string|int, mixed>
- Load filter options from a data source
- organizeViewCells() : array<string|int, mixed>
- Organize view cells by type and display order.
- processDataverseGrid() : array<string|int, mixed>
- Process dataverse grid request with unified logic
- resolveNestedValue() : mixed
- Resolve nested value from entity using dot notation path
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
$Gatherings
public
GatheringsTable
$Gatherings
$inject
Service dependency injection configuration
public
static array<string|int, string>
$inject
= [\App\Services\CsvExportService::class, \App\Services\GatheringActivityService::class, \App\Services\GatheringCloneService::class, \App\Services\GatheringScheduleService::class, \App\Services\ICalendarService::class]
Service injection configuration
$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()
Add method
public
add() : Response|null|void
Creates a new gathering. Activities can be added after creation.
Return values
Response|null|void —Redirects on successful add, renders view otherwise.
addActivity()
Add Activity method
public
addActivity(GatheringActivityService $activityService[, string|null $id = null ]) : Response|null
Adds one or more activities to a gathering via modal.
Parameters
- $activityService : GatheringActivityService
- $id : string|null = null
-
Gathering id.
Tags
Return values
Response|null —Redirects to view.
addScheduledActivity()
Add scheduled activity
public
addScheduledActivity(GatheringScheduleService $scheduleService[, mixed $publicId = null ]) : Response|null
Creates a new scheduled activity for a gathering via AJAX modal.
Parameters
- $scheduleService : GatheringScheduleService
- $publicId : mixed = null
Return values
Response|null —JSON response
allGatherings()
All gatherings method - Filtered gathering listing with export capability
public
allGatherings(CsvExportService $csvExportService, string $state) : Response|null|void
Provides gathering listing with temporal filtering (this_month, next_month, future, previous), pagination, and CSV export. Uses user timezone for accurate month boundary calculations.
Parameters
- $csvExportService : CsvExportService
-
CSV export service
- $state : string
-
Temporal filter state (this_month|next_month|future|previous)
Tags
Return values
Response|null|void —Renders gathering list or returns CSV export
attendanceModal()
Attendance Modal - Returns the attendance modal content for AJAX loading
public
attendanceModal([string|null $id = null ]) : void
This action provides the attendance modal form dynamically for use in the calendar view. It reuses the attendGatheringModal element to ensure consistent UI and functionality.
Parameters
- $id : string|null = null
-
Gathering ID
beforeFilter()
Before filter callback
public
beforeFilter(EventInterface $event) : Response|null|void
Parameters
- $event : EventInterface
-
The beforeFilter event
Return values
Response|null|voidcalendar()
Calendar view method
public
calendar() : Response|null|void
Displays gatherings in an interactive calendar format with month/week/list views. Allows users to view, filter, and mark attendance for gatherings.
Return values
Response|null|void —Renders calendar view
calendarGridData()
Dataverse grid data provider for calendar layout
public
calendarGridData(CsvExportService $csvExportService) : Response|null
Parameters
- $csvExportService : CsvExportService
-
CSV export service
Return values
Response|nullcancel()
Cancel method
public
cancel([string|null $id = null ]) : Response|null
Marks a gathering as cancelled without deleting it. Preserves all associated data (waivers, attendances, etc.)
Parameters
- $id : string|null = null
-
Gathering id.
Tags
Return values
Response|null —Redirects to view.
clone()
Clone method
public
clone(GatheringCloneService $cloneService[, string|null $id = null ]) : Response|null
Creates a copy of an existing gathering with new name and dates. Optionally includes all activities from the original gathering.
Parameters
- $cloneService : GatheringCloneService
- $id : string|null = null
-
Gathering id to clone.
Tags
Return values
Response|null —Redirects on success.
delete()
Delete method
public
delete([string|null $id = null ]) : Response|null
Soft deletes a gathering.
Parameters
- $id : string|null = null
-
Gathering id.
Tags
Return values
Response|null —Redirects to index.
deleteScheduledActivity()
Delete scheduled activity
public
deleteScheduledActivity(GatheringScheduleService $scheduleService[, mixed $gatheringPublicId = null ][, string|null $id = null ]) : Response|null
Removes a scheduled activity from a gathering.
Parameters
- $scheduleService : GatheringScheduleService
- $gatheringPublicId : mixed = null
- $id : string|null = null
-
Scheduled activity id
Return values
Response|null —Redirect response
downloadCalendar()
Download calendar file for a gathering
public
downloadCalendar(ICalendarService $iCalendarService[, string|null $publicId = null ]) : Response
Generates an iCalendar (.ics) file that can be imported into calendar applications (Google Calendar, Outlook, iOS Calendar, etc.)
Security logic:
- If gathering has public_page_enabled = true: accessible to anyone (authenticated or not)
- If gathering has public_page_enabled = false: requires authentication (but no policy check)
Parameters
- $iCalendarService : ICalendarService
-
iCalendar service
- $publicId : string|null = null
-
Gathering public ID (for public access)
Tags
Return values
Response —iCalendar file download response
edit()
Edit method
public
edit([string|null $id = null ]) : Response|null|void
Edits an existing gathering. Activities are locked if waivers have been uploaded (T118).
Parameters
- $id : string|null = null
-
Gathering id.
Tags
Return values
Response|null|void —Redirects on successful edit, renders view otherwise.
editActivityDescription()
Edit Activity Description method
public
editActivityDescription(GatheringActivityService $activityService[, string|null $gatheringId = null ]) : Response|null
Updates the custom description for an activity in a gathering.
Parameters
- $activityService : GatheringActivityService
- $gatheringId : string|null = null
-
Gathering id.
Tags
Return values
Response|null —Redirects to view.
editScheduledActivity()
Edit scheduled activity
public
editScheduledActivity(GatheringScheduleService $scheduleService[, mixed $gatheringPublicId = null ][, string|null $id = null ]) : Response|null
Updates an existing scheduled activity via AJAX modal.
Parameters
- $scheduleService : GatheringScheduleService
- $gatheringPublicId : mixed = null
- $id : string|null = null
-
Scheduled activity id
Return values
Response|null —JSON response
feed()
Public iCalendar subscription feed.
public
feed(ICalendarService $iCalendarService) : Response
Returns a multi-event VCALENDAR that calendar apps can subscribe to. Accepts the same filter[column][] query parameters as the calendar grid.
Parameters
- $iCalendarService : ICalendarService
-
iCalendar service
Return values
Response —iCalendar feed response
gridData()
Grid Data provider for gatherings index dv_grid
public
gridData(CsvExportService $csvExportService) : Response|null
Parameters
- $csvExportService : CsvExportService
-
CSV export service
Return values
Response|nullindex()
Index method
public
index() : Response|null|void
Lists all gatherings with filtering options.
Return values
Response|null|void —Renders view
initialize()
Initialize controller
public
initialize() : void
isCsvRequest()
Check if current request is for CSV export.
public
isCsvRequest() : bool
Return values
boolmobileCalendar()
Mobile calendar view
public
mobileCalendar() : Response|null|void
Renders a touch-optimized calendar view for mobile devices. Uses swipe navigation and simplified event display.
Return values
Response|null|voidmobileCalendarData()
Mobile calendar data endpoint
public
mobileCalendarData() : Response
Returns JSON data for the mobile calendar view. Optimized for mobile with minimal data transfer.
Return values
Responsepaginate()
public
paginate([mixed $object = = 'null' ][, array<string|int, mixed> $settings = = '[]' ]) : array<string|int, Gathering>|ResultSetInterface
Parameters
- $object : mixed = = 'null'
- $settings : array<string|int, mixed> = = '[]'
Return values
array<string|int, Gathering>|ResultSetInterfacepublicLanding()
Public landing page for a gathering
public
publicLanding([mixed $publicId = null ]) : Response|null|void
Displays a beautiful, mobile-friendly event landing page that requires no authentication. This page showcases all gathering information including schedule, activities, location, and provides a streamlined experience for potential attendees.
Parameters
- $publicId : mixed = null
Return values
Response|null|void —Renders view
quickView()
Quick view method for calendar modal
public
quickView([mixed $publicId = null ]) : Response|null|void
Returns a simplified view of a gathering for the calendar quick view modal. This provides essential information without the full page layout.
Parameters
- $publicId : mixed = null
Tags
Return values
Response|null|void —Renders quick view partial
removeActivity()
Remove Activity method
public
removeActivity(GatheringActivityService $activityService[, string|null $gatheringId = null ][, string|null $activityId = null ]) : Response|null
Removes an activity from a gathering.
Parameters
- $activityService : GatheringActivityService
- $gatheringId : string|null = null
-
Gathering id.
- $activityId : string|null = null
-
Activity id.
Tags
Return values
Response|null —Redirects to view.
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
uncancel()
Uncancel method
public
uncancel([string|null $id = null ]) : Response|null
Removes the cancelled status from a gathering.
Parameters
- $id : string|null = null
-
Gathering id.
Tags
Return values
Response|null —Redirects to view.
view()
View method
public
view([mixed $publicId = null ]) : Response|null|void
Displays gathering details including activities and required waivers.
Parameters
- $publicId : mixed = null
Tags
Return values
Response|null|void —Renders view
addConditions()
Add conditions - Optimize gathering queries for performance and security
protected
addConditions(Query $query) : Query
Applies query optimization and field selection for gathering listing operations. Supports branch filtering via query parameters.
Parameters
- $query : Query
-
Base gathering query to optimize
Return values
Query —Optimized query with conditions
applyCustomFilterHandlers()
Apply custom filter handlers for columns with complex filtering logic
protected
applyCustomFilterHandlers(SelectQuery $query, array<string|int, mixed> $customFilterColumns, string $tableName, bool $canFilter, array<string|int, mixed> $currentFilters, mixed $currentView, array<string|int, mixed>|null $selectedSystemView, bool $dirtyFilters) : SelectQuery
Columns can define a customFilterHandler in their metadata to specify
a static method that handles their filtering. This allows complex filter
logic (like querying multiple tables) to be defined alongside the column
definition rather than requiring special controller knowledge.
Filter values are extracted from:
- Query string parameters (user-applied filters)
- Saved user view configuration (when loading a saved view)
- System view configuration (when loading a system view)
Parameters
- $query : SelectQuery
-
The query to filter
- $customFilterColumns : array<string|int, mixed>
-
Columns with customFilterHandler defined
- $tableName : string
-
The main table name
- $canFilter : bool
-
Whether user filtering is enabled
- $currentFilters : array<string|int, mixed>
-
Current filter values from query params
- $currentView : mixed
-
Current saved user view (or null)
- $selectedSystemView : array<string|int, mixed>|null
-
Current system view config (or null)
- $dirtyFilters : bool
-
Whether user explicitly modified filters
Return values
SelectQuery —The filtered query
authorizeCurrentUrl()
Authorize the current URL/action via Authorization component.
protected
authorizeCurrentUrl() : void
Tags
buildDataverseGridState()
Build complete grid state object (single source of truth)
protected
buildDataverseGridState(mixed $currentView, array<string|int, mixed>|null $selectedSystemView, array<string|int, mixed>|null $systemViews, iterable<string|int, mixed> $availableViews, Member|null $currentMember, string|int|null $preferredViewId, string $search, array<string|int, mixed> $filters, array<string|int, mixed> $filterOptions, array<string|int, mixed> $dropdownFilterColumns, array<string|int, mixed> $dateRangeFilterColumns, array<string|int, mixed> $sort, array<string|int, mixed> $visibleColumns, array<string|int, mixed> $allColumns, string $gridKey, int $pageSize, bool $showAllTab, bool $canAddViews, bool $canFilter, bool $hasSearch, bool $hasDropdownFilters, bool $hasDateRangeFilters, array<string|int, mixed> $skipFilterColumns, bool $canExportCsv, bool $showFilterPills, bool $showViewTabs, bool $enableColumnPicker[, array<string|int, mixed> $lockedFilters = [] ][, bool $enableBulkSelection = false ][, array<string|int, mixed> $bulkActions = [] ]) : array<string|int, mixed>
Parameters
- $currentView : mixed
-
Current saved view entity (null for system views or "All")
- $selectedSystemView : array<string|int, mixed>|null
-
Currently selected system view
- $systemViews : array<string|int, mixed>|null
-
All available system views
- $availableViews : iterable<string|int, mixed>
-
Collection of saved views
- $currentMember : Member|null
-
Authenticated member
- $preferredViewId : string|int|null
-
Preferred view ID from user preferences
- $search : string
-
Current search term
- $filters : array<string|int, mixed>
-
Active filters by column key
- $filterOptions : array<string|int, mixed>
-
Available filter options by column key
- $dropdownFilterColumns : array<string|int, mixed>
-
Metadata for filterable columns
- $dateRangeFilterColumns : array<string|int, mixed>
- $sort : array<string|int, mixed>
-
Current sort configuration
- $visibleColumns : array<string|int, mixed>
-
Array of visible column keys
- $allColumns : array<string|int, mixed>
-
Complete column metadata
- $gridKey : string
-
Unique grid identifier
- $pageSize : int
-
Number of rows per page
- $showAllTab : bool
-
Whether to show "All" tab
- $canAddViews : bool
-
Whether users can create custom views
- $canFilter : bool
-
Whether filtering is enabled
- $hasSearch : bool
- $hasDropdownFilters : bool
- $hasDateRangeFilters : bool
- $skipFilterColumns : array<string|int, mixed>
-
Columns with filter UI but not query application
- $canExportCsv : bool
-
Whether CSV export button is shown
- $showFilterPills : bool
-
Whether active filter pills/badges are displayed
- $showViewTabs : bool
-
Whether view tabs are displayed
- $enableColumnPicker : bool
-
Whether column picker is available
- $lockedFilters : array<string|int, mixed> = []
-
Filter column keys that cannot be removed by users
- $enableBulkSelection : bool = false
- $bulkActions : array<string|int, mixed> = []
Return values
array<string|int, mixed> —Complete grid state
buildExportDataFromEntities()
Build export data from pre-processed entities (Data Mode)
protected
buildExportDataFromEntities(iterable<string|int, mixed> $data, array<string|int, mixed> $visibleColumns, array<string|int, mixed> $columnsMetadata) : array<string|int, mixed>
Extracts values from entities using column metadata configuration. Supports virtual properties, nested relations via renderField, and custom exportValue callbacks.
Parameters
- $data : iterable<string|int, mixed>
-
Pre-processed entities or arrays
- $visibleColumns : array<string|int, mixed>
-
List of visible column keys
- $columnsMetadata : array<string|int, mixed>
-
Column configuration metadata
Return values
array<string|int, mixed> —Transformed data ready for CSV export
buildExportDataFromQuery()
Build export data from database query (Query Mode)
protected
buildExportDataFromQuery(Query $query, array<string|int, mixed> $visibleColumns, array<string|int, mixed> $columnsMetadata, string $tableName) : array<string|int, mixed>
Builds SQL SELECT statements and executes query for simple database fields. Best for exports that don't require computed fields.
Parameters
- $query : Query
-
Database query to execute
- $visibleColumns : array<string|int, mixed>
-
List of visible column keys
- $columnsMetadata : array<string|int, mixed>
-
Column configuration metadata
- $tableName : string
-
Full table name for model alias extraction
Return values
array<string|int, mixed> —Transformed data ready for CSV export
buildGatheringSystemViewQueryCallback()
Build query callback for temporal system views
protected
buildGatheringSystemViewQueryCallback(string $userTimezone) : callable
Parameters
- $userTimezone : string
-
User timezone identifier
Return values
callableextractExportValue()
Extract export value from entity using column metadata
protected
extractExportValue(mixed $entity, string $columnKey, array<string|int, mixed> $columnMeta) : string
Resolution order:
- exportValue callback if defined in column metadata
- renderField path for nested entity access (e.g., 'member.name_for_herald')
- Direct property access using column key
Parameters
- $entity : mixed
-
Entity or array to extract value from
- $columnKey : string
-
Column key identifier
- $columnMeta : array<string|int, mixed>
-
Column metadata configuration
Return values
string —Extracted and formatted value
extractFilterFromExpression()
Recursively extract a filter value from an expression tree
protected
extractFilterFromExpression(array<string|int, mixed> $expression, string $columnKey) : mixed
Parameters
- $expression : array<string|int, mixed>
-
The expression node to search
- $columnKey : string
-
The column key to find
Return values
mixed —The filter value or null if not found
extractFilterFromSystemView()
Extract a specific filter value from a system view configuration
protected
extractFilterFromSystemView(array<string|int, mixed> $systemView, string $columnKey) : mixed
Parameters
- $systemView : array<string|int, mixed>
-
The system view configuration
- $columnKey : string
-
The column key to find
Return values
mixed —The filter value or null if not found
extractFilterFromViewConfig()
Extract a specific filter value from a saved user view's config
protected
extractFilterFromViewConfig(mixed $view, string $columnKey) : mixed
Parameters
- $view : mixed
-
The GridView entity
- $columnKey : string
-
The column key to find
Return values
mixed —The filter value or null if not found
extractFilterGrouping()
Extract filter grouping information from expression tree
protected
extractFilterGrouping(array<string|int, mixed>|null $selectedSystemView, array<string|int, mixed> $skipFilterColumns) : array<string|int, mixed>
Analyzes the expression tree to determine OR relationships between filters. Returns metadata that the frontend can use to display visual OR indicators.
Parameters
- $selectedSystemView : array<string|int, mixed>|null
-
Currently active system view
- $skipFilterColumns : array<string|int, mixed>
-
Columns that show as pills but don't query
Return values
array<string|int, mixed> —Grouping metadata with 'orGroups' array
extractSystemViewDefaults()
Extract default filters/search metadata for a system view configuration
protected
extractSystemViewDefaults(array<string, mixed> $systemViewConfig) : array{filters: array, dateRange: array, search: ?string, skipFilterColumns: array}
Parameters
- $systemViewConfig : array<string, mixed>
-
Raw system view config
Return values
array{filters: array, dateRange: array, search: ?string, skipFilterColumns: array}formatExportValue()
Format value for CSV export
protected
formatExportValue(mixed $value) : string
Handles various data types and converts to string representation.
Parameters
- $value : mixed
-
Value to format
Return values
string —Formatted string value
handleCsvExport()
Handle CSV export from grid result
protected
handleCsvExport(array<string|int, mixed> $result, CsvExportService $csvExportService, string $entityName[, string|null $tableName = null ][, iterable<string|int, mixed>|null $data = null ]) : Response
Generates a CSV export response from the grid processing result. Supports two modes:
-
Query Mode (default): Uses the query from result to build SQL SELECT statements. Best for simple fields that map directly to database columns.
-
Data Mode: Pass pre-processed data with computed/virtual fields already populated. Best for exports that include calculated fields, virtual properties, or complex transformations that can't be done in SQL.
Column Value Resolution (in order of precedence):
exportValuecallback in column metadata - custom formatting functionrenderFieldpath (e.g., 'member.name_for_herald') - for nested entity accessqueryFieldfor relation columns in query mode- Direct column key access on entity/array
Parameters
- $result : array<string|int, mixed>
-
Result from processDataverseGrid() with isCsvExport flag
- $csvExportService : CsvExportService
-
CSV export service instance
- $entityName : string
-
Base name for the export file (e.g., 'members', 'warrants')
- $tableName : string|null = null
-
Optional table name for fetchTable (e.g., 'Awards.Recommendations' for plugin tables) If not provided, uses ucfirst($entityName)
- $data : iterable<string|int, mixed>|null = null
-
Optional pre-processed data. If provided, uses data mode instead of query mode. Data should be an iterable of entities or arrays with all computed fields populated.
Tags
Return values
Response —CSV download response
isCsvExportRequest()
Check if the current request is for CSV export
protected
isCsvExportRequest() : bool
Return values
bool —True if CSV export is requested
loadFilterOptions()
Load filter options from a data source
protected
loadFilterOptions(array<string|int, mixed>|string $source) : array<string|int, mixed>
Supports multiple formats for filterOptionsSource:
-
Simple string (table name): Uses 'id' for value, 'name' for label
'filterOptionsSource' => 'Branches' -
Array with table: Database table with full control
'filterOptionsSource' => [ 'table' => 'Waivers.WaiverTypes', // Required: table name for fetchTable() 'valueField' => 'id', // Optional: field for option value (default: 'id') 'labelField' => 'name', // Optional: field for option label (default: 'name') 'conditions' => ['is_active' => true], // Optional: filter conditions 'order' => ['name' => 'ASC'], // Optional: sort order (default: labelField ASC) ] -
Array with appSetting: Load from app settings (YAML array)
'filterOptionsSource' => [ 'appSetting' => 'Branches.Types', // Required: app setting key ]The app setting should contain a YAML array like: ['Kingdom', 'Principality', 'Barony'] Both value and label will be set to the array item value.
-
Array with method: Call a static method on a class to get options
'filterOptionsSource' => [ 'method' => 'getGatheringsFilterOptions', // Required: static method name 'class' => 'Awards\\KMP\\GridColumns\\RecommendationsGridColumns', // Required: fully qualified class name ]The method should return array of ['value' => string, 'label' => string].
Parameters
- $source : array<string|int, mixed>|string
-
Source identifier string (table name) or configuration array
Return values
array<string|int, mixed> —Filter options as array of ['value' => string, 'label' => string]
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
processDataverseGrid()
Process dataverse grid request with unified logic
protected
processDataverseGrid(array<string|int, mixed> $config) : array<string|int, mixed>
This method handles all aspects of grid processing including view management, filtering, searching, sorting, and pagination. It supports both saved user views and system-defined views.
Parameters
- $config : array<string|int, mixed>
-
Grid configuration with the following keys:
- gridKey (string): Unique identifier for the grid
- gridColumnsClass (string): Fully qualified class name for grid columns metadata
- baseQuery (Query): Base query object to start with
- tableName (string): Primary table name for field qualification
- defaultSort (array): Default sort configuration ['field' => 'direction']
- defaultPageSize (int): Default number of records per page (default: 25)
- systemViews (array|null): Optional array of system views (for Warrants-style grids)
- defaultSystemView (string|null): Default system view key (required if systemViews provided)
- queryCallback (callable|null): Optional callback to modify query per system view
- showAllTab (bool): Whether to show "All" tab (default: true for saved views, false for system views)
- canAddViews (bool): Whether users can create custom views (default: true)
- canFilter (bool): Whether user filtering is enabled (default: true). When false, users cannot add/remove filters via the UI or query parameters. However, filters defined by system views are ALWAYS applied regardless of this setting.
- canExportCsv (bool): Whether CSV export button is shown (default: true)
- showFilterPills (bool): Whether active filter pills/badges are displayed (default: true)
- showViewTabs (bool): Whether view tabs are displayed (default: true)
- enableColumnPicker (bool): Whether column picker is available (default: true)
- lockedFilters (array): Array of filter column keys that cannot be removed by users. Locked filters will not show remove (×) buttons and their values cannot be cleared via query string parameters. Useful for embedded grids where context filters (e.g., member_id) must always be applied.
- enableBulkSelection (bool): Whether row selection checkboxes are shown (default: false)
- bulkActions (array): Array of bulk action button configurations when enableBulkSelection is true. Each action is an array with keys: label, icon, modalTarget, permission.
NOTE: Authorization scope must be applied to baseQuery BEFORE calling this method. Use
$baseQuery = $this->Authorization->applyScope($baseQuery, 'index');in your controller before passing the query to processDataverseGrid().
Return values
array<string|int, mixed> —Result array with keys: data, gridState, columnsMetadata, etc.
resolveNestedValue()
Resolve nested value from entity using dot notation path
protected
resolveNestedValue(mixed $entity, string $path) : mixed
Parameters
- $entity : mixed
-
Entity to traverse
- $path : string
-
Dot-notation path (e.g., 'member.name_for_herald')
Return values
mixed —Resolved value or null if path doesn't exist