Getting Crazy with Form Themes

1:00:24

What you'll be learning

This tutorial is built on Symfony 3 but form theming hasn't changed much in Symfony 4 and Symfony 5. Other than some path differences - this tutorial should work fine.
// composer.json
{
    "require": {
        "php": ">=5.5.9",
        "symfony/symfony": "3.1.*", // v3.1.4
        "doctrine/orm": "^2.5", // v2.7.2
        "doctrine/doctrine-bundle": "^1.6", // 1.6.4
        "doctrine/doctrine-cache-bundle": "^1.2", // 1.3.0
        "symfony/swiftmailer-bundle": "^2.3", // v2.3.11
        "symfony/monolog-bundle": "^2.8", // 2.11.1
        "symfony/polyfill-apcu": "^1.0", // v1.2.0
        "sensio/distribution-bundle": "^5.0", // v5.0.22
        "sensio/framework-extra-bundle": "^3.0.2", // v3.0.16
        "incenteev/composer-parameter-handler": "^2.0", // v2.1.2
        "composer/package-versions-deprecated": "^1.11", // 1.11.99
        "knplabs/knp-markdown-bundle": "^1.4", // 1.4.2
        "doctrine/doctrine-migrations-bundle": "^1.1", // 1.1.1
        "stof/doctrine-extensions-bundle": "^1.2" // v1.2.2
    },
    "require-dev": {
        "sensio/generator-bundle": "^3.0", // v3.0.7
        "symfony/phpunit-bridge": "^3.0", // v3.1.3
        "nelmio/alice": "^2.1", // 2.1.4
        "doctrine/doctrine-fixtures-bundle": "^2.3" // 2.3.0
    }
}

We already learned all the form basics. But, controlling how you render your forms? That's a huge and super-fun topic all on its own. Themes! Form variables! Rainbows! Let's go!

  • Creating your own form theme
  • Controller form variables
  • Using form variables in your theme
  • Rendering a field 100% by hand
  • Controller variables in your form type
  • Adding a "help" text system that renders for all fields
  • Leveraging a FormTypeExtension to tweak any field in your system
  • Customizing how a single field renders

This stuff is black magic: learn these fundamentals, and you'll be unstoppable!


Your Guides

Ryan Weaver Leanna Pelham

Buy Access

Questions? Conversation?