Files
VITEC-website/packages/vitec/Configuration/TCA/tx_vitec_domain_model_searchcard.php
orasche 91ad5e6596 Search cards above the results, detail-page fallback for market/solution documents
- New record type tx_vitec_domain_model_searchcard ("best bets"):
  keyword list, priority, optional referenced record (page, product,
  story, solution, market, news) and overridable title/teaser/image/link;
  hidden/start/end time allow timed campaigns
- SearchCardService delivers content.search.cards on page 1: max. 3,
  priority-ordered, deduplicated by URL, independent of filter, facets
  and result count. Keywords match as whole words/phrases, case- and
  punctuation-insensitive, including one level of the Solr managed
  synonyms in both directions (cached for an hour, fail-soft). Record
  cards read the record's indexed Solr document, so a card always
  matches the record's own search result
- Index fallback for markets and solutions: when the record carries no
  image or text, the document takes the intro image (then the hero
  background) and the hero subline, intro headline and intro text from
  the content blocks of its detail page - selected by CType, so it works
  for layout 21 and layout 5 alike; improves results and cards
- Fix: a search request without q returned an empty body instead of the
  documented empty shape (stdClass resolved inside the renderer namespace)
- migrations/check_solution_fields.php: shows live/workspace versions of
  solution records
- Spec v1.22 (clause 7.16: cards)
2026-10-09 12:59:12 +02:00

136 lines
5.0 KiB
PHP

<?php
/*
* Search cards ("best bets", 2026-10-09): editorial cards shown ABOVE the
* search results when the query contains one of the card's keywords.
*
* A card either points to an existing record (title, teaser, image and URL
* then come from that record's Solr document, i.e. exactly what the result
* list shows) or is maintained freely. Filled card fields always override
* the record values. Rendered by SearchCardService into content.search.cards
* (spec clause 7.16). The storage folder is free - every visible card counts.
*/
return [
'ctrl' => [
'title' => 'VITEC Search Card',
'label' => 'title',
'label_alt' => 'keywords',
'label_alt_force' => true,
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'delete' => 'deleted',
'default_sortby' => 'priority DESC, title ASC',
'enablecolumns' => [
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
],
'searchFields' => 'title,keywords,card_title,teaser',
'iconfile' => 'EXT:vitec/Resources/Public/Icons/vitec-search-card.svg',
'security' => [
'ignorePageTypeRestriction' => true,
],
],
'types' => [
'1' => [
'showitem' => '
--div--;Trigger, title, keywords, priority,
--div--;Card content, record, card_title, teaser, image, --palette--;;link,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access, hidden, starttime, endtime',
],
],
'palettes' => [
'link' => [
'label' => 'Button',
'showitem' => 'link, link_label',
],
],
'columns' => [
'title' => [
'label' => 'Internal name',
'description' => 'Only for the backend list, never shown on the website.',
'config' => [
'type' => 'input',
'size' => 40,
'max' => 255,
'required' => true,
],
],
'keywords' => [
'label' => 'Keywords',
'description' => 'Comma or line separated. The card appears when the search contains one of these terms (whole words, case-insensitive; Solr synonyms count too). Example: control room, soc, noc, command centre',
'config' => [
'type' => 'text',
'rows' => 3,
'cols' => 60,
'required' => true,
],
],
'priority' => [
'label' => 'Priority',
'description' => 'At most 3 cards are shown; higher numbers win.',
'config' => [
'type' => 'number',
'default' => 0,
'range' => ['lower' => -100, 'upper' => 100],
],
],
'record' => [
'label' => 'Show this record',
'description' => 'Title, teaser, image and link come from the record (as in the search results). Leave empty for a free card. A record that is hidden or not in the search index is skipped unless the fields below fill the gap.',
'config' => [
'type' => 'group',
'allowed' => 'pages,tx_vitec_domain_model_product,tx_vitec_domain_model_usecase,tx_vitec_domain_model_solution,tx_vitec_domain_model_market,tx_news_domain_model_news',
'size' => 1,
'maxitems' => 1,
'minitems' => 0,
],
],
'card_title' => [
'label' => 'Card title',
'description' => 'Required for free cards; overrides the record title otherwise.',
'config' => [
'type' => 'input',
'size' => 40,
'max' => 255,
],
],
'teaser' => [
'label' => 'Teaser',
'description' => 'Plain text, about 160 characters. Overrides the record teaser.',
'config' => [
'type' => 'text',
'rows' => 3,
'cols' => 60,
'max' => 400,
],
],
'image' => [
'label' => 'Image',
'description' => 'Overrides the record image. Delivered as a 640px tile like the result images.',
'config' => [
'type' => 'file',
'maxitems' => 1,
'allowed' => 'common-image-types',
],
],
'link' => [
'label' => 'Link',
'description' => 'Required for free cards; overrides the record URL otherwise.',
'config' => [
'type' => 'link',
'allowedTypes' => ['page', 'url', 'record', 'file'],
],
],
'link_label' => [
'label' => 'Button label',
'description' => 'Empty = the frontend default (e.g. "Learn more").',
'config' => [
'type' => 'input',
'size' => 20,
'max' => 80,
],
],
],
];