Flag of Ukraine
SymfonyCasts stands united with the people of Ukraine

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": "^7.1.3",
        "symfony/symfony": "3.4.*", // v3.4.49
        "doctrine/orm": "^2.5", // 2.7.5
        "doctrine/doctrine-bundle": "^1.6", // 1.12.13
        "doctrine/doctrine-cache-bundle": "^1.2", // 1.4.0
        "symfony/swiftmailer-bundle": "^2.3", // v2.6.7
        "symfony/monolog-bundle": "^2.8", // v2.12.1
        "symfony/polyfill-apcu": "^1.0", // v1.23.0
        "sensio/distribution-bundle": "^5.0", // v5.0.25
        "sensio/framework-extra-bundle": "^3.0.2", // v3.0.29
        "incenteev/composer-parameter-handler": "^2.0", // v2.1.4
        "composer/package-versions-deprecated": "^1.11", // 1.11.99.4
        "knplabs/knp-markdown-bundle": "^1.4", // 1.9.0
        "doctrine/doctrine-migrations-bundle": "^1.1", // v1.3.2
        "stof/doctrine-extensions-bundle": "^1.2" // v1.3.0
    },
    "require-dev": {
        "sensio/generator-bundle": "^3.0", // v3.1.7
        "symfony/phpunit-bridge": "^3.0", // v3.4.47
        "nelmio/alice": "^2.1", // v2.3.6
        "doctrine/doctrine-fixtures-bundle": "^2.3" // v2.4.1
    }
}

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

Join the Conversation?

2
Login or Register to join the conversation
Default user avatar
Default user avatar Stefan Bauer | posted 5 years ago

Would like to see something about prototypes :)

Reply
Cat in space

"Houston: no signs of life"
Start the conversation!

userVoice