Backend of the sub-market template (spec agreed section by section with

the customer workflow in mind: the customer fills one XLSX per sub-market,
an importer builds the page).

- Frontend layout 21 'Sub-Market Page' in the existing
  BackendLayoutDataProvider: six zones, one per Figma section, emitted as
  colPos110..colPos160 - the JSON groups plus appearance.layout are the
  front-end contract (spec clause 7.17). A first attempt via page-TSconfig
  BackendLayouts was the wrong mechanism next to the provider and was
  removed again
- New Content Blocks vitec_markethero, vitec_marketintro,
  vitec_marketinsights (field bags, serialized unprefixed under data);
  the workflow section reuses intro-paragraph + vitec_card flip cards
- Stories gained quote/quote_person/quote_role (Testimonial tab),
  maintained once per story, emitted on every story card; usecaselist
  gained the layout value 'testimonials'
- New plugin vitec_productfeature: one referenced product as a full
  product card, serialisation shared with the product list (cObj made
  protected for the subclass)
- vitec_productlist gained hand-picked product selection: exactly the
  chosen products in the editor's order, category filter ignored,
  visibility filters kept - closes the long-standing single-select gap
- New CLI vitec:generate-submarket-workbooks: one protected customer
  XLSX per sub-market (9 main markets, 25 sub-markets from the Market
  category tree) - dropdowns filled live from the database, named ranges
  as the importer contract, hidden Meta sheet pinning submarket/group/
  record uid, soft character-limit warnings, asset URL fields

Verified end to end on Broadcast & Media: layout-21 payload with colPos110
carrying the hero element and its subline. Spec raised to v1.20.
This commit is contained in:
orasche committed 2026-10-02 10:18:36 +02:00
1 parent f0b0694842
commit 90ae6803a4
31 files changed
+493 -7

No files matched your search

@@ -51,6 +51,12 @@ final class UsecaseSerializer
'teaser' => (string)($u['teaser'] ?? ''),
'cardImage' => $this->image($uid, 'card_image', null, true),
'customerLogo' => $this->image($uid, 'customer_logo'),
// Testimonial data (2026-10-01): one quote per story, maintained
// on the record, consumed by testimonial cards (sub-market
// template). Empty strings when not yet maintained.
'quote' => (string)($u['quote'] ?? ''),
'quotePerson' => (string)($u['quote_person'] ?? ''),
'quoteRole' => (string)($u['quote_role'] ?? ''),
'markets' => $this->relationMulti('tx_vitec_usecase_market_mm', 'tx_vitec_domain_model_market', $uid),
'categories' => $this->categories($uid),
'featured' => (bool)($u['featured'] ?? false),
@@ -0,0 +1,58 @@
<?php
declare(strict_types=1);
namespace Evomedien\Vitec\UserFunc;
use Doctrine\DBAL\ParameterType;
use TYPO3\CMS\Core\Attribute\AsAllowedCallable;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Service\FlexFormService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Featured product card - sub-market template section 5 (spec 2026-10-01).
*
* One referenced product, emitted as a single full product card under the
* payload key `productfeature`. All copy comes from the product record
* (decision Olli 2026-10-01: dropdown only, no free text) - the front end
* renders image, title and teaser from the same card shape the product
* list delivers, so no second contract exists.
*
* Extends ProductListJsonRenderer purely to reuse its serializeProduct()
* and image handling - same filters, same shape, one source of truth.
*/
final class ProductFeatureJsonRenderer extends ProductListJsonRenderer
{
#[AsAllowedCallable]
public function render(string $content = '', array $conf = []): string
{
try {
$row = $this->cObj?->data ?? [];
$flexFormData = GeneralUtility::makeInstance(FlexFormService::class)
->convertFlexFormContentToArray((string)($row['pi_flexform'] ?? ''));
$productUid = (int)($flexFormData['settings']['product'] ?? 0);
if ($productUid <= 0) {
return (string)json_encode(null);
}
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tx_vitec_domain_model_product');
$product = $queryBuilder->select('*')->from('tx_vitec_domain_model_product')
->where(
$queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($productUid, ParameterType::INTEGER)),
$queryBuilder->expr()->eq('deleted', 0),
$queryBuilder->expr()->eq('hidden', 0),
$queryBuilder->expr()->eq('hideonwebsite', 0)
)
->executeQuery()->fetchAssociative();
if (!$product) {
return (string)json_encode(null);
}
return (string)json_encode($this->serializeProduct($product), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
} catch (\Throwable) {
return (string)json_encode(null);
}
}
}
@@ -31,7 +31,9 @@ use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
*/
class ProductListJsonRenderer
{
private ?ContentObjectRenderer $cObj = null;
// protected (not private) since 2026-10-01: ProductFeatureJsonRenderer
// extends this class to reuse serializeProduct() and needs the cObj.
protected ?ContentObjectRenderer $cObj = null;
/**
* TYPO3 v14 hands the ContentObjectRenderer over through this setter only -
@@ -119,6 +121,14 @@ class ProductListJsonRenderer
}
$debugMode = (bool)($settings['debug'] ?? false);
$allProducts = (bool)($settings['allproducts'] ?? false);
// Explicit picks (2026-10-01, built for the sub-market template's
// Products section): when set, EXACTLY these products in the
// editor's order - the category filter is ignored. The visibility
// filters below stay in force on purpose, so a hidden/legacy
// record never surfaces through a stale selection.
$selectedUids = array_filter(
array_map('intval', explode(',', (string)($settings['selectedproducts'] ?? '')))
);
// Extbase repositories don't work in UserFunc context — direct query.
$productQueryBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)
@@ -137,7 +147,11 @@ class ProductListJsonRenderer
$productQueryBuilder->expr()->eq('p.subproduct', 0)
);
if (!empty($categoryUids) && !$allProducts) {
if ($selectedUids !== [] && !$allProducts) {
$productQuery->andWhere(
$productQueryBuilder->expr()->in('p.uid', $productQueryBuilder->createNamedParameter($selectedUids, Connection::PARAM_INT_ARRAY))
);
} elseif (!empty($categoryUids) && !$allProducts) {
$productQuery
->join(
'p',
@@ -159,7 +173,12 @@ class ProductListJsonRenderer
// sitemap. $categoryUids comes from expandWithDescendants in
// depth-first tree order; within one category the uid order is
// kept - the records were created in sitemap-V2 row order.
if (!empty($categoryUids) && !$allProducts && $products !== []) {
if ($selectedUids !== [] && !$allProducts && $products !== []) {
// Editor's order, not storage order.
$rankBySelection = array_flip($selectedUids);
usort($products, static fn(array $a, array $b): int =>
($rankBySelection[(int)$a['uid']] ?? PHP_INT_MAX) <=> ($rankBySelection[(int)$b['uid']] ?? PHP_INT_MAX));
} elseif (!empty($categoryUids) && !$allProducts && $products !== []) {
$rankByCategory = array_flip($categoryUids);
$mmQueryBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)
->getQueryBuilderForTable('sys_category_record_mm');
@@ -27,6 +27,15 @@ final class BackendLayoutDataProvider implements DataProviderInterface
'hero' => 1,
'sidebar' => 2,
'preFooter' => 3,
// Sub-market template sections (spec 2026-10-01): one slot per Figma
// section. The headless JSON groups these as colPos110..colPos160 -
// that grouping IS the front-end contract for layout 21.
'smHero' => 110,
'smIntro' => 120,
'smWorkflow' => 130,
'smTestimonials' => 140,
'smProducts' => 150,
'smInsights' => 160,
];
/** Per-frontend-layout: title + ordered list of zones. */
@@ -52,6 +61,7 @@ final class BackendLayoutDataProvider implements DataProviderInterface
18 => ['title' => 'Content Page V3', 'zones' => ['hero', 'main', 'sidebar', 'preFooter']],
19 => ['title' => 'Events Overview', 'zones' => ['hero', 'main']],
20 => ['title' => 'Contact Page', 'zones' => ['hero', 'main', 'sidebar']],
21 => ['title' => 'Sub-Market Page', 'zones' => ['smHero', 'smIntro', 'smWorkflow', 'smTestimonials', 'smProducts', 'smInsights']],
];
/** Display name for each zone. Shown as column header in the BE page module. */
@@ -60,6 +70,12 @@ final class BackendLayoutDataProvider implements DataProviderInterface
'hero' => 'Hero',
'sidebar' => 'Sidebar',
'preFooter' => 'Pre-Footer',
'smHero' => '1 · Hero',
'smIntro' => '2 · Intro',
'smWorkflow' => '3 · Workflow (header + flip cards)',
'smTestimonials' => '4 · Testimonials',
'smProducts' => '5 · Products (featured + list)',
'smInsights' => '6 · Industry Insights',
];
public function getIdentifier(): string