Developer API
Craft Vault is schema-only: its Install migration creates a set of archive
tables (see Yui\Vault\db\Table), and a CP-only DashboardService reports
on them. The plugin does not yet expose a Twig variable, console command, or
a service with public methods to move data into the archive tables.
Yui\Vault\services\VaultService currently has no methods of its own.
Archive tables
| Constant | Table | Mirrors |
|---|---|---|
Table::ARCHIVE_ORDERS | {{%archive_orders}} | yStore order header fields (customer, addresses, totals, payment/shipping method, currency, status) |
Table::ARCHIVE_ORDER_ITEMS | {{%archive_order_items}} | Order line items (SKU, name, type, pricing, qty, weight, custom options) |
Table::ARCHIVE_ORDER_HISTORY | {{%archive_order_history}} | Order status/comment history |
Table::ARCHIVE_QUOTES | {{%archive_quotes}} | Cart/quote header fields (customer, addresses, shipping) |
Table::ARCHIVE_QUOTE_ITEMS | {{%archive_quote_items}} | Quote line items |
All tables use an auto-increment entity_id primary key plus dateCreated/
dateUpdated timestamps, and reference the originating order/quote by
order_id. Column shapes closely mirror the corresponding live yStore order
and quote tables (see Yui\Vault\migrations\db\ArchiveOrdersDb for the full
column set).
Table creation/removal on install/uninstall is handled by
Yui\Vault\migrations\traits\TableManager, shared with Install::safeUp() /
safeDown().
Dashboard
Yui\Vault\controllers\DashboardController extends the shared
yui\craftcore\controllers\AbstractDashboardController and renders at
vault/dashboard. It has no permission gate, so any user with access to
the Vault CP nav can view it.
Yui\Vault\services\DashboardService (registered as the dashboard
component) extends yui\craftcore\services\CoreDashboardService and
builds four modules, all reading from Table::ARCHIVE_ORDERS:
| Handle | Type | Description |
|---|---|---|
vault-archived-period | KPI | Count of archived orders within the selected/default date range (defaults to the last 29 days) |
vault-archived-all-time | KPI | Total archived order count, all time |
vault-last-access | KPI | Date/time of the most recently archived order, or "Never" |
vault-recent-archives | List | The 8 most recently archived orders (order number, email, timestamp) |
The dashboard's block layout is customizable and persisted to
Settings::$dashboardLayout via DashboardService::saveLayoutData()
(vault/dashboard/save-layout, shared with the core dashboard's layout
editor). Vault doesn't override isDemoMode(), so the dashboard always
shows live data, never demo/placeholder values.
Routes
Registered via Yui\Vault\plugin\Routes, plus vault/dashboard and
vault/dashboard/save-layout, which resolve to DashboardController
through Craft's default controller/action routing (no explicit rule
needed):
| Route | Action |
|---|---|
vault/dashboard | Dashboard overview page |
vault/dashboard/save-layout | Persist dashboard block layout (AJAX, POST) |
vault/settings | Settings page |
vault/license | License page |
vault/license/redeem, /revoke, /activate, /delete, /copy-token | Shared license actions, see Plugin Licenses |
Events
None. Yui\Vault\plugin\Events::_registerGlobalEvents() is an empty stub in
this release.
Compatibility
- Craft CMS 5.2+
yui/craft-core^1- Composer package:
yui/craft-vault