> Symfony 3 >

Course Overview

Login to bookmark this course

Getting Crazy with Form Themes

Go wild with form styles in Symfony! Learn to create custom themes, use form variables, render fields 100%, and much more.

  • 1517 students
  • EN Captions
  • EN Script
  • Certificate of Completion

Your Guides

About this course

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.

What PHP libraries does this tutorial use?

// 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!

Next courses in the Symfony 3: Young Jedi section of the Symfony 3 Track!

2 Comments

Sort By
Login or Register to join the conversation
Default user avatar Stefan Bauer 6 years ago

Would like to see something about prototypes :)

| Reply |

It's coming... soon ... :) http://knpuniversity.com/sc...

1 | Reply |

Delete comment?

Share this comment

astronaut with balloons in space

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