Twig Functions, Filters, and Debugging with dump

Video loading...

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:05
    with Leanna Pelham
  • 0:09
    Just like PHP or JavaScript, Twig
  • 0:10
    has functions that can be used once we're inside either a say something
  • 0:14
    or do something Twig delimiter.
  • 0:16
    To see the built in functions, once again,
  • 0:18
    check out the bottom of the Twig documentation.
  • 0:21
    In your application, especially if you're using Twig inside something
  • 0:24
    like Symphony or Drupal, you may have
  • 0:26
    even more functions available to you.
  • 0:29
    Fortunately, the syntax to use a function is always the same.
Loading ...

Twig Functions, Filters, and Debugging with dump

Loading...

Just like PHP or JavaScript, Twig has functions that can be used once we’re inside either a Twig delimiter. To see the built-in functions, check out the bottom of the Twig documentation page. In your application, especially if you’re using Twig inside something like Symfony or Drupal, you may have even more functions available to you. Fortunately, the syntax to use a function is always the same: just check out your project’s documentation to see what other goodies you have. In this tutorial, you will start using Twig functions and filters to get the length of a collection in our demo site. We'll also play around with the dump function to see how we can go about debugging Twig.

Downloads: 
Log in or sign up to download companion files.
Additional resources: