{#
SAM Page Header Component
Parameters:
- title: string (required) - Page title
- icon: string - Icon name for the title (book, users, layers, grid, settings, chart, folder, file)
- badge: string|number - Badge displayed before the title (e.g., section position)
- subtitle: string - Subtitle with HTML support
- status: object { visible: bool } - Shows visible/hidden pill
- buttons: array - Action buttons
- text: string - Button label
- url: string - Link URL (not needed for sync or dataAction buttons)
- style: string - primary, outline, secondary, danger, success
- icon: string - plus, sync, edit, trash, download, upload, eye, link
- sync: bool - If true, uses sync controller instead of link
- dataAction: string - Stimulus data-action attribute (e.g., "click->controller#method")
- sync: object { url: string, label: string } - Sync controller config
- companySelector: object { companies, company, baseUrl, isAdmin } - Company selector for admins
Usage examples:
Basic:
{% include 'sam/_components/page_header.html.twig' with {
title: 'Gestion des cours',
icon: 'book',
subtitle: '102 cours',
buttons: [{ text: 'Synchroniser', style: 'outline', icon: 'sync', sync: true }],
sync: { url: path('app_sam_sync'), label: 'cours' }
} %}
With Stimulus action button:
{% include 'sam/_components/page_header.html.twig' with {
title: 'Gestion des cohortes',
icon: 'layers',
subtitle: '15 cohortes',
buttons: [
{ text: 'Synchroniser', style: 'outline', icon: 'sync', sync: true },
{ text: 'Créer', style: 'primary', icon: 'plus', dataAction: 'click->controller#openModal' }
],
sync: { url: path('app_sam_sync'), label: 'cohortes' }
} %}
With badge and status (for sections):
{% include 'sam/_components/page_header.html.twig' with {
title: 'Introduction',
badge: 1,
subtitle: '5 activités',
status: { visible: true }
} %}
#}
{% set iconSvgs = {
'book': '