Postez les "truc" que vous avez trouvez et qui vous semblent importants.

Liste des extensions pour Twig et des fonctions apportées

FormExtension


  • form_enctype
  • form_field
  • form_hidden
  • form_errors
  • form_label
  • form_data
  • form_row

SecurityExtension

  • has_role
    {{ ROLE_ADMIN | has_role }}
    retourne TRUE si l'utilisateur a pour rôle "ROLE_ADMIN"

TemplatingExtension

  • yaml_encode
  • dump
  • abbr_class
  • abbr_method
  • format_args
  • format_args_as_text
  • file_excerpt
  • format_file
  • format_file_from_text


  • url
    génère une route absolue (voir path syntaxe)
  • path
    {{ path('route", {'param1': 'valeur1',...}) }}
    suit une route : route avec les paramètres
  • asset

TransExtension (i18n)

  • trans
    {% trans "Symfony is great!" %}

    {% transchoice count %}
    {0} There is no apples|{1} There is one apple|]1,Inf] There is {{ count }} apples
    {% endtranschoice %}