X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Ftwig%2Ftwig%2Fdoc%2Ffilters%2Flength.rst;fp=vendor%2Ftwig%2Ftwig%2Fdoc%2Ffilters%2Flength.rst;h=5620f3b3c4d6f16eb6f32a13e5db290400855c93;hp=0000000000000000000000000000000000000000;hb=eba34333e3c89f208d2f72fa91351ad019a71583;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae diff --git a/vendor/twig/twig/doc/filters/length.rst b/vendor/twig/twig/doc/filters/length.rst new file mode 100644 index 000000000..5620f3b3c --- /dev/null +++ b/vendor/twig/twig/doc/filters/length.rst @@ -0,0 +1,21 @@ +``length`` +========== + +.. versionadded:: 1.33 + + Support for the ``__toString()`` magic method has been added in Twig 1.33. + +The ``length`` filter returns the number of items of a sequence or mapping, or +the length of a string. + +For objects that implement the ``Countable`` interface, ``length`` will use the +return value of the ``count()`` method. + +For objects that implement the ``__toString()`` magic method (and not ``Countable``), +it will return the length of the string provided by that method. + +.. code-block:: jinja + + {% if users|length > 10 %} + ... + {% endif %}