KMP PHP API Reference

RecommendationFormService
in package

Prepares lookup data for recommendation edit forms (full, quick, and bulk).

Centralises the dropdown, gathering-list, and status-list preparation that is shared by turboEditForm, turboQuickEditForm, and turboBulkEditForm. Keeps the controller methods thin while preserving the exact same data contracts expected by the Turbo Frame templates.

Tags
see
RecommendationsController::turboEditForm()
see
RecommendationsController::turboQuickEditForm()
see
RecommendationsController::turboBulkEditForm()

Table of Contents

Methods

buildBranchesList()  : array<string|int, mixed>
Build the branches dropdown list.
buildStatusList()  : array<string, array<string, string>>
Build the status list formatted for dropdown display.
prepareBulkEditFormData()  : array<string, mixed>
Prepare all view variables for the bulk edit form.
prepareEditFormData()  : array<string, mixed>
Prepare all view variables for a single-recommendation edit form (full or quick).

Methods

buildBranchesList()

Build the branches dropdown list.

public buildBranchesList(Table $awardsTable) : array<string|int, mixed>
Parameters
$awardsTable : Table

The Awards ORM table (must have Branches association).

Return values
array<string|int, mixed>

Branches list keyed by "id|can_have_members".

buildStatusList()

Build the status list formatted for dropdown display.

public buildStatusList() : array<string, array<string, string>>

Converts the entity's state/status map into a grouped array where each status key maps to an associative array of state => state.

Return values
array<string, array<string, string>>

Grouped status list.

prepareBulkEditFormData()

Prepare all view variables for the bulk edit form.

public prepareBulkEditFormData(Table $recommendationsTable) : array<string, mixed>

Loads branches, all gatherings (with cancelled markers), and status/state rules. Returns an associative array matching the compact() variables expected by the bulk edit template.

Parameters
$recommendationsTable : Table

The Recommendations ORM table.

Return values
array<string, mixed>

View variables: rules, branches, gatheringList, statusList, cancelledGatheringIds.

prepareEditFormData()

Prepare all view variables for a single-recommendation edit form (full or quick).

public prepareEditFormData(Table $recommendationsTable, Recommendation $recommendation, callable $getFilteredGatherings) : array<string, mixed>

Loads awards-by-domain, domains, levels, branches, gatherings, cancelled-gathering indicators, and state rules. Returns an associative array matching the set of compact() variables expected by the Turbo Frame edit templates.

Parameters
$recommendationsTable : Table

The Recommendations ORM table.

$recommendation : Recommendation

The loaded recommendation entity (with contains).

$getFilteredGatherings : callable

A callback(awardId, memberId, futureOnly, gatheringId, selectedIds) returning filtered gatherings.

Return values
array<string, mixed>

View variables: rules, recommendation, branches, awards, gatheringList, cancelledGatheringIds, awardsDomains, awardsLevels, statusList, assignedGatheringCancelled.


        
On this page

Search results