Skip to content

jeffsenso/prestashop-skills / skills/prestashop-module-development/ps9-core-ai/Component/Forms/skills/create-form-tab-layout

create-form-tab-layout

Verified

Create a multi-tab form layout using PrestaShop's NavigationTabType. This is a specific pattern for complex forms with many fields organized by tabs — NOT the default form layout. Most forms do not need tabs. Trigger: "create tab layout for {Domain} form", "add tabs to {Domain} form".

FileKindSize
SKILL.mdskill md1.8 KB
---
name: create-form-tab-layout
description: >
  Create a multi-tab form layout using PrestaShop's NavigationTabType. This is a
  specific pattern for complex forms with many fields organized by tabs — NOT the
  default form layout. Most forms do not need tabs. Trigger: "create tab layout
  for {Domain} form", "add tabs to {Domain} form".
needs: [create-form-type]
produces: "NavigationTabType-based tab structure with sub-form types per tab"
conditional: "only for complex entities with many fields requiring tab organization"
---

# create-form-tab-layout

> **This is NOT the default form pattern.** Most entity forms are simple single-page forms
> using `TranslatorAwareType` or `AbstractType`. Only use `NavigationTabType` when the entity
> has many fields that benefit from tab organization (e.g. Carrier with general, shipping,
> size/weight tabs).

## Instructions

1. In root `{Domain}Type`, declare `NavigationTabType` as the parent type via `getParent()`:
   ```php
   public function getParent(): string
   {
       return NavigationTabType::class;
   }
   ```
   Then in `buildForm()`, add each tab as a sub-form — each child is rendered as a tab.
2. Create one form type per tab: `{Domain}GeneralTabType.php`, `{Domain}ShippingTabType.php`, etc.
3. Each tab type extends `TranslatorAwareType` with its own `buildForm()` containing only that tab's fields.
4. Tab anchor IDs (used for JS error scrolling) are derived from the tab names.

**Reference:** `src/PrestaShopBundle/Form/Admin/Shipping/Carrier/CarrierType.php`, `src/PrestaShopBundle/Form/Admin/Sell/Product/EditProductFormType.php`

## Rules

Conventions (NavigationTabType is PS-specific, tab anchor IDs for JS error nav) are in [Forms/CONTEXT.md](../../CONTEXT.md). Skill-specific reminders:

- Each tab gets its own form type class for maintainability
- Tab titles must use `$this->trans()` for translation
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 196kUpdated Claude CodeCodexVerifiedInstall