Portal Frontend Plugin Surfaces
The detail behind Portal Frontend Plugins: how to use each thing a plugin can contribute, and the traps in each.
Read the main guide first — it covers the PHP side, the frontend build, the plugin module and the lifecycle. This page assumes a plugin that already loads.
Using the kit's components
ui.* publishes the portal's own component library — Button, DataTable, Panel,
MetaList, SectionHeader, EmptyState, TabStrip, PathTag, FlagIcon, Icon,
IconButton, SanitizeHtml. Build with these rather than raw antd wherever one fits: the
portal's screens are made of them, and a contributed control that isn't is visibly a plugin.
Two are worth calling out. ui.Button is not antd's — Studio wraps it and adds a loading
state that locks the measured size, so a row does not reflow mid-request. ui.SanitizeHtml
is how you render server-supplied rich text; reaching for dangerouslySetInnerHTML instead
renders perfectly on your own test content and is the wrong thing on someone else's.
It is a curated list, not the kit's whole barrel. Ask if you need one that isn't there.
Don't
npm installthe kit into your plugin. It is not a Module Federation shared module, so a direct install gives you a second copy — with a second DI container. Container-backed components (anything resolving an icon) then render empty with no error anywhere.Making the kit a shared singleton does work, but it is not switched on — see below.
Restyling the portal
Prefer a --p-* design token when one covers what you need. That is the supported way to
rebrand: it survives markup changes, and the portal already derives twelve of them per portal
from the brand settings, server-side.
Beyond tokens there is no published class contract — the p-* names the kit emits are not a
promised surface, so a stylesheet targeting them can break in any release.
Services: naming things in the container
Your onInit receives the DI container, and serviceIds names what is in it:
const grid = getService<DynamicTypeGridCellRegistry>(
serviceIds['DynamicTypes/GridCellRegistry']
)
grid?.registerDynamicType(myCell)
serviceIds[...] | what registering there does |
|---|---|
DynamicTypes/GridCellRegistry | how a field is drawn in the listing |
DynamicTypes/FieldFilterRegistry | filter controls per field type |
DynamicTypes/ObjectLayoutRegistry | layout containers of an object's detail form |
DynamicTypes/ObjectDataRegistry | field renderers — the leaves of that form |
DynamicTypes/MetadataRegistry | asset metadata rows on the detail screen |
DataObject/Editor/TypeRegistry | which editor a data-object type opens with |
DynamicTypes/ThemeRegistry | Studio themes (see the caveat below) |
globalMessageBus | server-pushed events, over the portal's single EventSource |
This is a curated subset: the portal's host binds 24 of Studio's ~370 ids. Use getService(),
which answers undefined on an unbound id — container.get() throws.
The component registry and icon library are bound but not listed: use the componentRegistry and
icons facades, which carry guardrails the raw services do not.
Registering a theme does not make it selectable. The theme id is stamped server-side by the Twig layouts and is not yet a per-portal value. The registry is named because it is bound and resolvable; the closed theme set is a separate, still-open gap.
Calling the portal API directly: what will bite you
api.injectEndpoints sends your request through the portal's own base query, so you get the api
base and the session for free — but the endpoints have shapes a caller would reasonably get
wrong, and most of them fail silently.
Full-text terms are named differently per endpoint, and must be arrays.
| Endpoint | Parameter |
|---|---|
/{kind}/list, /list-folders, /list-tags, /select-all-ids | searchTerms[] |
/{kind}/list-filters | q[] |
| the suggest endpoint | q[] |
Both must be repeated array parameters. getFullTextSearchQuery() applies the terms only
when is_array($searchTerms), so a scalar is dropped and the list comes back unfiltered —
the request succeeds, the result is just wrong, which is the worst way for this to fail.
Other sharp edges:
/{kind}/list-foldersthrowsUndefined array key "folder"without afolderparameter — it is required, not optional./collection/renameanswers a bare 500 without_locale, becausesetLocaleruns before its own try/catch, so the failure never reaches the handler that would explain it.
The portal's own toQuery() in api/portalApi.ts encodes all of this; reading it is faster than
rediscovering it.
Parts of the published OpenAPI contract are marked
x-derived-from-codewithx-confidence: MEDIUM. Those schemas were derived from the PHP hydrators rather than captured from a live response, because the endpoint was empty-state, side-effecting or errored on a bare call. They are honest guesses and may not match what the server actually returns — treat a generated client for those endpoints as a starting point, not a contract.
Limits that are closed by construction
Not everything is extensible, and two are worth stating so you do not spend an afternoon on them:
- Map editing.
leaflet-drawis aliased to an empty stub in the portal's build, so every Studio geo toolbar returns before it touchesL.Control.Draw. The portal is read-only for geodata by construction rather than by convention, and no plugin can turn it on without changing the host build. - Client-side routing. There is no client router in the portal — no route table to register into, and no way to intercept navigation. The portal is server-rendered pages with React islands. (A plugin can own a server route; see below.)
Public shares: a second audience, opted into explicitly
A public share is a link the portal's users create for people outside the organisation. Its recipient is anonymous — no account, no profile, no collections of their own, and no cart that outlives the link — and the recipient shell is the most widely seen part of the portal.
By default your plugin does not run there at all. To opt in, implement
PublicSharePluginProviderInterface on your provider:
use Pimcore\Bundle\PortalEngineBundle\Service\Plugin\PublicSharePluginProviderInterface;
class MyPluginProvider implements PortalPluginProviderInterface, PublicSharePluginProviderInterface
{
public function isAvailableForPublicShare(): bool
{
return true;
}
}
The gate is server-side: a plugin that has not opted in is never named in a recipient page, so its bundle is never fetched. Both gates apply, in order — a plugin the portal has not enabled does not appear to a recipient just because it declared itself share-safe.
Ask which audience you are rendering for
import { isPublicShare } from '@pimcore/portal-plugin-sdk'
if (isPublicShare()) {
// no account: offer nothing that needs one
}
There is nothing in your props to infer this from, and you must not try to work it out yourself:
module-level state is a different instance inside the federated ./sdk chunk, and the recipient
shell is a different template, not a different URL shape. The server states it before any plugin
code runs. Anything but the literal 'portal' reads as the share audience — treating a recipient
as a portal user is a security bug, while the reverse only hides a feature.
The permission payload points the wrong way
This is the part that will catch you. A share GRANTS collectionAdd, downloadCart and
publicShare on the elements it exposes — true for the portal's own download flow, and wrong
for anything a plugin would do with it. All three are default-OPEN, so an uncapped payload answers
"allowed" whether the flag is granted or absent:
can.addToCollection(rawSharePayload) // true — for an anonymous stranger
The portal caps the permissions it hands a contribution, so can.* is already honest on anything
you were passed. If you hold a payload you fetched yourself, apply the same rule:
import { capForPublicShare } from '@pimcore/portal-plugin-sdk'
can.addToCollection(capForPublicShare(mine)) // false
can.download(capForPublicShare(mine)) // still honours the share's own flag
The cap keeps view and download as stated and denies everything else explicitly — deleting
a key would not deny it, because absent means allowed.
What still does not reach a recipient
The chrome slots (headerActions, navEntries) are on the authenticated layout only, so a
recipient shell has no header or nav contributions regardless of opting in.
Permissions: read the flags the way the portal does
An element's permission flags are optional, and what an absent flag means is not the same in both directions:
| rule | absent means | |
|---|---|---|
reads (view, download, collectionAdd, publicShare, …) | !== false | allowed |
writes (edit, update, delete) | === true | denied |
Writing the obvious p.delete !== false gets writes wrong, and nothing on the page says so: the
control appears, and only the server's refusal says otherwise. Use the gates, not the flags:
actions.register(actions.surfaces.gridItem, {
key: 'my-plugin/relocate-ish',
when: (ctx) => can.relocate(ctx.permissions), // the portal's own rule for this action
…
})
can.* matches the portal's gate of the same name, so a contributed control appears under
exactly the same conditions as the built-in beside it. For anything without a named gate,
permissionRead(p, flag) and permissionWrite(p, flag) name which rule they apply — and if you
are unsure which a new control is, it is a write.
createandsubfolderhave no named gate on purpose: the portal readscreateboth ways (=== trueto offer Upload,!== falseto enable a folder as a move target) and both are right where they are. Pick per call site.
These are element permissions, not user permissions. There is no ambient "what may this user do" payload in the portal; that is an open gap.
Tile regions: draw part of the portal's own grid tiles
renderMedia / renderMeta on components.TileCard reshape a tile your plugin draws.
Registering a tile region reshapes the tiles the portal draws — every tile in the listing:
componentRegistry.register({
name: tileRegions.media, // or tileRegions.meta
component: ({ id, name, thumbnail, fileExtension }: TileRegionProps) => <MyPreview … />
})
media is the preview area — you replace the picture, not the frame, so the selection checkbox,
the open affordance and the tile's keyboard handling stay the portal's. meta is the block under
the name, empty on the portal's own tiles, so it is purely additive.
The tile as a whole is not replaceable. A region keeps the portal's selection, opening and permission-gated actions; replacing the tile would mean reimplementing all of them.
Detail cards: replace or suppress one
Beyond appending through the detailPanels slot, these cards are resolved through the component
registry by name, so you can replace or suppress one:
detailCards.* | what it is |
|---|---|
tags | assigned/available tags, with the save control |
workflow | current workflow state and its transitions |
customDownload | made-to-measure rendition download |
versions | the Versions tab's body |
Register a component under the name to replace it:
componentRegistry.register({ name: detailCards.tags, component: MyTagsCard })
Register one that renders nothing to suppress it:
componentRegistry.register({ name: detailCards.workflow, component: () => null })
There is no separate "hide" call, because a component that returns null already is one.
A replacement receives exactly the props the portal's own card would have — TagsCardProps,
WorkflowCardProps, CustomDownloadCardProps and VersionsTabProps are exported for this.
WorkflowCardProps.details is typed unknown: it is the portal's own server DTO.
The results rail is not replaceable. Its tiles are reachable through components.TileCard.
api: cache tags
injectEndpoints extends the endpoint map but cannot add tag types. There are two ways to
live with that, and both work.
The smallest is the Plugin type the portal declares for exactly this. Tags are {type, id}
pairs, so scoping the id with your plugin name gives you a space of your own:
providesTags: [{ type: 'Plugin', id: 'my-plugin/things' }]
Or register types of your own, through RTK's enhanceEndpoints:
sdk.api.addTagTypes(['my-plugin/Thing'])
providesTags: [{ type: 'my-plugin/Thing', id: 'LIST' }]
Namespace the type with your plugin name. Tag types are one flat space shared with the portal
and every other plugin, and that is where a collision bites: two plugins that both declare
Settings invalidate each other's caches, which shows up as a refetch nobody asked for and is
very hard to trace. Adding a type twice is a no-op, so calling addTagTypes on every init is
safe.
An undeclared tag still invalidates: RTK matches tags structurally and does not filter them against the declared list, which only drives a development-mode
console.error. Declare anyway — it is the supported route and leaves no console noise.assets/portal/tests/unit/rtk-tag-behaviour.test.tspins this.