{manager:slices:field:item_id:code:conds:sort:mode:edit_code}

Description

Renders an inline management panel for the items related to the current one - a small admin UI with action buttons (New, Delete, Settings, Edit, eXternal edit, Back, file upload) over a queried set of items. It is an editing-context expression: it emits admin HTML plus the AA Site-edit JavaScript, so it only does something for a logged-in editor on a page that carries the parent item. The classic use is a parent item that owns a set of child items (for example an article that owns its photos); the photo slice has a relation field pointing back to the article, and the manager lets the editor add, edit, reorder and delete those photos in place with instant redraw. Pass the related slice id, the relation field that points back to the parent, the parent item id (the current item when omitted), and the per-row template code. The code is rendered once per related item; if it contains the literal token _#actions the action buttons replace that token and your own row markup is used, otherwise a standard card wrapper is added. The mode parameter selects which buttons appear and may be given as flag letters or as a jsonasoc map of custom button labels. With edit_code the panel can also render an inline edit form for one chosen item. The expression never caches, so it reflects the live set on every request.

Parameters

slices required

Id of the slice (or several ids) holding the items you want to manage. These are the related/child items, for example a photos slice. With more than one id the panel manages items across all of them.

field optional default (none)

Relation field id on the managed slice that points back to the parent item. When set, the panel automatically adds the condition that this field equals item_id, and the New button pre-sets this field on each new item to the parent. Omit it if you supply your own conds instead.

item_id optional default current item id

Id of the parent item the related items belong to. Defaults to the current item (the one being displayed) when left empty. Used together with field to build the relation condition.

code optional

Template rendered once for each related item - the row body. Use the managed slice's field-getters or aliases, often a constant like _#ROW_EDIT, and inline {live} editors. If the code contains the literal token _#actions, the action buttons are placed where that token sits and your own row markup is used; otherwise the row is wrapped in a standard card and the buttons are appended.

conds optional

Extra AA conditions (DB-AA condition syntax) used to query the managed items. If you pass field and item_id the relation condition is added automatically; conds lets you filter further or replace it. With neither field+item_id nor conds the panel renders nothing and logs a No conditions warning.

sort optional default publish_date....

Sort specification for the managed items (a field id, optionally with a direction). Defaults to publish_date... when omitted.

mode optional default ND (NDEB when edit_code is set)

Which action buttons appear. Give it as flag letters in any order - N new, D delete, S settings, E edit, X external edit, B back, F file upload, or a single - for view only. It may instead be a {jsonasoc:...} map to set custom button labels, where the key Dconfirm overrides the delete confirmation text. Default is ND, or NDEB when edit_code is supplied.

edit_code optional

Template used to render the inline edit form for the one item being edited (the item chosen with the Edit or eXternal-edit button). It is expanded as the code for that item, typically a constant like _#EDIT_ITM that contains {live} editors. Supplying it turns on the E and B buttons by default.

Examples

virtual{manager:45d43f4d567dd8a9f459aa51576a6ce2:relation........:{id..............}:{headline........}:::{jsonasoc:N:Add photo:D:Remove:Dconfirm:Really remove this photo?}}
Expected(panel with an "Add photo" button and a per-row "Remove" button that confirms "Really remove this photo?")
Actual
Instead of flag letters, mode can be a jsonasoc map that both selects the buttons and labels them. Here the New button reads "Add photo", the Delete button reads "Remove", and Dconfirm replaces the default delete confirmation text. Any key left empty falls back to its default label.
virtual{manager:45d43f4d567dd8a9f459aa51576a6ce2:relation........:{id..............}:<div class="photo"><img src="{img_src........}"><span>{headline........}</span>_#actions</div>}
Expected(your custom div per photo with the image and headline, the action buttons rendered inline where _#actions was)
Actual
If the row code contains the literal token _#actions, the manager drops the default card wrapper and uses your markup as-is, substituting the action buttons where _#actions sits. This gives full control over each row layout while keeping the New, Delete and other buttons.
virtual{manager:45d43f4d567dd8a9f459aa51576a6ce2:relation........:{id..............}:{headline........}:::NDF}
Expected(panel with New and Delete plus a "drop files here or click to upload" area that creates a related item per file)
Actual
The F flag adds a Dropzone drop area below the list. Files dropped there are uploaded into a new related item (into its first file, img_upload or img_src field) and the panel redraws. Combined with N and D you get add-by-form, add-by-upload and delete together.
virtual{manager:45d43f4d567dd8a9f459aa51576a6ce2:relation........:{id..............}:{headline........}::::_#EDIT_ITM}
Expected(panel with New, Delete and per-row Edit buttons; clicking Edit swaps the row for the _#EDIT_ITM form with a Back button)
Actual
Supplying edit_code (the last parameter) turns on inline editing: the default mode becomes NDEB, so each row also gets an Edit button and the edit form shows a Back button. When a row is edited the panel re-renders just that item using the edit_code template (here the constant _#EDIT_ITM, which would contain {live} editors).
virtual{manager:45d43f4d567dd8a9f459aa51576a6ce2:relation........:{id..............}:{headline........}:::NDS}
Expected(panel with New, Delete and a per-row Settings gear that opens the full item editor in the Toolbox)
Actual
Adding S to the flags shows a settings button on each row. It opens the related item in the AA Toolbox - the full item editor - rather than an inline form. Here the editor gets New, Delete and Settings buttons.
virtual{manager:45d43f4d567dd8a9f459aa51576a6ce2::{id..............}:{headline........}:d-source_href.....-LIKE-%{id..............}%:headline........-:N}
Expected(panel of items matching the source_href condition, sorted by headline, with a New button)
Actual
You do not have to use a relation field. Leave field empty and pass your own conds (here a LIKE match on source_href.....) plus an explicit sort (by headline). Only the New button is shown. Without field the New button cannot pre-set the back-reference, so this form is best for read or query-driven panels.
virtual{manager:45d43f4d567dd8a9f459aa51576a6ce2:relation........::_#ROW_EDIT}
Expected(same panel as the previous example - the related items of the current item)
Actual
The third parameter (item_id) is left empty, so the panel uses the current item as the parent. This is the same as passing {id..............} explicitly. Note the empty slot between the field and the code (two colons).
virtual{manager:45d43f4d567dd8a9f459aa51576a6ce2:relation........:{id..............}:_#ROW_EDIT}
Expected(an admin panel listing the related photos, each with a Delete button, plus a New button - editor-only HTML)
Actual
The classic pattern. Manage the items of the photos slice (first id) whose relation field points back to the current item ({id..............}). Each photo is rendered with the photos slice constant _#ROW_EDIT. With the default mode ND the editor gets New and Delete buttons and instant redraw.
virtual{manager:45d43f4d567dd8a9f459aa51576a6ce2:relation........:{id..............}:{headline........}:::-}
Expected(a plain list of the related item headlines, no New/Delete/Edit buttons)
Actual
Mode set to a single dash gives a read-only list with no action buttons - useful to show the related items without offering edits. The empty conds and sort slots keep the defaults. Here each row just prints the related item headline.