Skip to content

Metadata sidebar

The read-only label/value list shown in element edit sidebars (post date, author, Shopify ID, sync status…). It’s a definition list, not a table, so screen readers pair each label with its value. Build one with Cp::metadataHtml().

Status
Active
Shopify ID
80412…9931
Last synced
2 minutes ago
Variants
4
Cp::metadataHtml([
    Craft::t('shopify', 'Shopify ID') => $product->shopifyId,
    Craft::t('shopify', 'Last synced') => $product->dateSynced,
    Craft::t('shopify', 'Variants') => count($product->variants),
]);
// Return this from your element's getSidebarHtml()
HTML output
<dl class="meta read-only">
  <div class="data">
    <dt class="heading">Shopify ID</dt>
    <dd class="value">80412…9931</dd>
  </div>
</dl>