Management Panel Data and Gates
The management panel away from the screen. 23 filters change lists and forms, 6 gates sit on staff actions, and 19 hooks report an event.
Overview
The panel's strongest hooks are here. List and form filters touch nearly every screen, because lists and forms come from one structure. You write one filter and it runs on dozens of screens.
That power cuts both ways. A filter that does not pick its target touches the whole panel. Each filter hands you the table or form name, and checking it is your job.
Reference
The ones that change data
The main ones among twenty-three. Most hand the value over by reference and ignore the return. The operation filters carry a mixed contract acting on what you return.
The ones that stop
All six sit on staff and permission work. Returning a non-empty string stops the action, and the operator reads that text as the error.
The ones that report
A filter with a target
// The second parameter IS THE TABLE NAME. Without checking it the filter runs on every list.
Hook::add('filter:admin.table.rows', 10, function (&$row, $table_name) {
if ($table_name !== 'serviceList') return null;
$id = (int) ($row['model']['id'] ?? 0);
if (Acme::flagged($id)) $row['attributes']['class'] = 'table-warning';
});
Pitfalls
Row and column filters run on every list in the panel. Skip the name check in the second parameter and a rule meant for the service list lands on invoices, customers and tickets. Make your first line the name check.
The column filter opens the heading and nothing else. The cell value for that column comes from the row filter. Writing one without the other leaves an empty column, or a cell that shows up nowhere.
The before-operation filter carries a mixed contract. An error array stops the operation. A variables array changes the inputs. An output array answers without running it at all. A wrong key name silently means "carry on".
On a hundred-row list the row filter runs a hundred times. A query inside it turns the list into a hundred queries. Gather what you need once into a static variable and read only that inside the listener.
Related Articles
Thanks for your feedback!
Our support team is here around the clock for anything you can't find above.