Embedding Contract
This page lists everything a host application relies on when it embeds the Statistics Explorer or the Statistics
Loader. It describes the current behavior and is pinned by the JS tests in assets/js (run them with the test
script of package.json). Changes to anything listed here are backwards compatibility breaks.
Endpoints
All endpoints are served by the bundle's StatisticsController under /<PREFIX>/{context}/.... {context} matches
\w+ and selects the user provider and data sources. Parameters are query parameters unless noted.
Errors are answered as {"success": false, "message": "..."} with status 500 (404 for a missing configuration).
Contexts without a user provider are answered with access denied by data-sources, field-collection,
field-settings and data; the other endpoints do not check it themselves.
| Endpoint | Used by | Parameters | Response |
|---|---|---|---|
/{context}/data-sources | explorer | – | success, dataSources, otherUsers (users and roles configurations can be shared with) |
/{context}/field-collection | explorer | dataSource | success, fields, operators |
/{context}/field-settings | explorer | dataSource, statisticMode, rows (JSON), columns (JSON) | fieldSettings |
/{context}/data | explorer, loader | dataSource, statisticMode (default statistic), rows (comma separated), columns (comma separated), filters (JSON), fieldSettings (JSON), locale, configurationId, chartData (boolean) | HTML table (statistic or list template), or with chartData=1 JSON columnHeaders and data |
/{context}/load-configuration-list | explorer | – | options: groups of {label, options: [{label, value}]} |
/{context}/save-configuration | explorer | form fields: configId (empty for new), name, configuration (JSON string, see below), sharedUsers, sharedRoles (comma separated) | success, configurationId, ownerShip |
/{context}/load | explorer, loader | configurationId | name, configurationId, configuration (JSON string), shares, ownerShip |
/{context}/delete | explorer | configurationId | success |
/{context}/translations | explorer, loader | locale | map of statistics_container.* keys to translations of locale when it is a valid language, else of the request locale; trailing line feeds trimmed |
statisticsExplorerConfig
A global window.statisticsExplorerConfig object holding one URL per endpoint. A missing or empty required key is
reported with console.error (the explorer also shows a toast) and nothing is mounted. Other keys are ignored.
| Key | Endpoint | Explorer | Loader |
|---|---|---|---|
dataSourceListUrl | data-sources | required | – |
fieldsListUrl | field-collection | required | – |
resultDataUrl | data | required | required |
loadFieldSettingsUrl | field-settings | required | – |
loadConfigurationListUrl | load-configuration-list | required | – |
saveConfigurationUrl | save-configuration | required | – |
loadConfigurationUrl | load | required | required |
deleteConfigurationUrl | delete | required | – |
translationsUrl | translations | required | required |
locale | – | optional | optional |
locale is the language the new build (assets/explorer) asks translations in; without it the page's
<html lang>, without that none (the request locale).
DOM hooks
#statistics-explorer: the node theexplorerentry renders into (looked up once, when the script runs)..statistics-container: every element with this class gets a loader from theloaderentry.data-config-id: on a.statistics-container, the id of the saved configuration to show, e.g.global_global1.
Webpack Encore entries: explorer and loader of the pimcoreStatisticsExplorer build.
The new build (assets/explorer) has the same two entries and keeps the hooks above. It ships in the bundle as
/bundles/pimcorestatisticsexplorer/explorer with one style sheet and one script per entry: static/css/<entry>.css
and static/js/<entry>.js (no content hash; the asset version handles caching). Lazy chunks load from beside the
script on their own.
Saved configuration JSON
save-configuration stores and load returns a JSON string with these fields. Rows and columns are saved without
the id the list widget adds for sorting.
| Field | Type | Meaning |
|---|---|---|
showTable | boolean | show the result table |
showChart | boolean | show the chart |
chartType | null, "Line", "Bar", "Area" or "Pie" | chart kind |
selectedDataSource | {label, value} | the data source |
statisticMode | "statistic" or "list" | statistic mode |
rows | array of {label, value} | row fields |
columns | array of {label, value} | column fields |
filters | array | filter definitions |
fieldSettings | object, field name to settings | per field settings |
The explorer applies all nine fields when loading, the loader passes them unchanged to the result view.