57 Commits

Author SHA1 Message Date
Fabien Potencier f03ddaef43 Merge branch '1.x' into 2.x
* 1.x:
  added more final classes
  add a comma to clarify the meaning
2016-12-23 09:06:20 +01:00
Christian Flothmann 7cd3c9d25f add a comma to clarify the meaning
Without the comma you could understand that the "if" not only applied
to `-1`, but to `1` as well if you read too quickly.
2016-12-23 08:52:50 +01:00
Fabien Potencier b7a5597f09 Merge branch '1.x' into 2.x
* 1.x:
  tweaked a deprecation notice
  added more docs about the range function
2016-12-23 07:53:11 +01:00
Fabien Potencier 40348480e7 added more docs about the range function 2016-12-23 07:21:48 +01:00
Fabien Potencier 183f062bbf removed obsolete code 2016-11-15 17:01:14 -05:00
Fabien Potencier 5a7b20205d Merge branch '1.x' into 2.x
* 1.x:
  exposed a way to access template data and methods in a portable way
  removed optimization as it's not compatible with Symfony cache system
2016-11-15 16:57:15 -05:00
Fabien Potencier d7062f35b8 exposed a way to access template data and methods in a portable way 2016-11-12 19:45:39 -08:00
Fabien Potencier 4c39e930cd remove obsolete docs 2016-11-12 18:12:38 -08:00
Fabien Potencier 26fefedbae Merge branch '1.x' into 2.x
* 1.x:
  updated CHANGELOG
  added with tag
  added missing docs
  added support for a custom template on the block() function
2016-11-12 18:11:17 -08:00
Fabien Potencier 02b084e2f5 feature #2245 added support for a custom template on the block() function (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

added support for a custom template on the block() function

`block()` allows one to render a block of the current template.

This PR adds the possibility to use `block()` to render a block of another template:

```twig
{{ block('footer', template_name) }}
```

As it uses the same logic as for the regular `block()`, you can also use it in a test:

```twig
{% if block('footer', template_name) is defined %}
    ...
{% endif %}
```

This removes the needs to use the internal `Twig_Template::renderBlock()` method in the Symfony Web Profiler for instance. And combined with #2236, it allows us to really mark the whole `Twig_Template` class as being internal.

I'm aware that #1302 asked for being able to pass a context to `block()` (implemented in #1433), but I prefer not to in favor of adding the `with` tag (see #719 and #1054).

When the `with` will be implemented, the code in the Symfony Web Profiler will become something along the lines of:

```twig
        {% with {
            'collector': profile.getcollector(name),
            'profiler_url': profiler_url,
            'token': profile.token,
            'name': name
          } %}
            {{ block('toolbar', template) }}
        {% endwith %}
```

Commits
-------

5ed59be added support for a custom template on the block() function
2016-11-12 17:38:59 -08:00
Fabien Potencier 065b2e26a2 added missing docs 2016-11-12 17:36:55 -08:00
Fabien Potencier 5ed59be9c5 added support for a custom template on the block() function 2016-11-12 17:34:29 -08:00
Fabien Potencier 05e1c68c4b Merge branch '1.x' into 2.x
* 1.x:
  added some more tests
  added 'is defined' support for constant
  added 'is defined' support for block()
  Add test to check if a block exists
2016-11-11 13:50:46 -08:00
Fabien Potencier c81bae489e added 'is defined' support for constant 2016-11-11 13:40:51 -08:00
Fabien Potencier 3ce06af6b4 added 'is defined' support for block() 2016-11-11 12:03:32 -08:00
Fabien Potencier 94586346be removed obsolete features 2016-09-28 10:49:38 -07:00
Fabien Potencier df9a1151ee Merge branch '1.x'
* 1.x:
  deprecated Twig_ExtensionInterface::getName()
  added some missing tests for functions/filters as static calls
  added missing information in deprecatd.rst
2016-09-28 10:45:26 -07:00
Fabien Potencier 71f03df011 deprecated Twig_ExtensionInterface::getName() 2016-09-28 10:05:09 -07:00
Fabien Potencier ff506eb9ab Merge branch '1.x'
* 1.x:
  fixed PHP 5.2 compat
  tweaked previous merge
  add ignore_missing agrument to source function
  updated CHANGELOG
2015-07-03 12:14:51 +02:00
Fabien Potencier 641090378d tweaked previous merge 2015-07-03 11:46:19 +02:00
Valeriy Trubachev afa93586bc add ignore_missing agrument to source function 2015-07-03 11:44:24 +02:00
Fabien Potencier 72cc7d8081 removed obsolete docs 2015-03-02 18:32:57 +01:00
Fabien Potencier 997f2f0823 fixed formatting in the docs 2014-10-11 01:31:53 +02:00
Brandon Kelly 2f5a927b72 date() documentation correction 2014-09-30 10:07:37 -07:00
Fabien Potencier 8e625ba57d minor #1336 Added additional example to min/max doc (c33s)
This PR was squashed before being merged into the 1.15-dev branch (closes #1336).

Discussion
----------

Added additional example to min/max doc

* fixed typo in the word "four"
* added an additional example with letters

Commits
-------

b709577 Added additional example to min/max doc
2014-02-24 16:39:24 +01:00
Julian b7095770e2 Added additional example to min/max doc 2014-02-24 16:39:24 +01:00
Fabien Potencier e9e4748475 added a note about how to check for dynamic attribute existence in the docs 2014-01-29 09:45:07 +01:00
Brandon Kelly 8958565cef Added a more clear example in the cycle() docs
The previous one was potentially misleading if you were focussed on the actual numbers (0 is even, not odd! etc.), and 99% of the time you’re going to be passing loop.index0 into cycle, so I felt that should be included in the example.
2014-01-24 04:27:48 -08:00
Fabien Potencier fcecb284f0 fixed markup 2013-12-03 15:16:16 +01:00
Grégoire Pineau 6aa06dea05 Added min and max function 2013-12-03 13:46:57 +01:00
Philipp Rieber a21df952ab [Docs] Some minor fixes: Typos, Notations 2013-11-23 21:51:26 +01:00
Fabien Potencier dff7d2c758 added a source function to include the content of a template without rendering it 2013-10-31 13:38:11 +01:00
Fabien Potencier 25e7befa37 fixed CS in docs 2013-10-26 08:29:21 +02:00
Karl Horky 9b7322496e missing closing parenthesis 2013-10-17 10:00:32 +02:00
Fabien Potencier 3e6e70e228 fixed a typo in the docs (closes #1136) 2013-07-13 21:17:34 +02:00
Fabien Potencier 15336c154c ordered tags, filters, functions, and tests in doc indexes 2013-02-21 07:47:52 +01:00
Grégoire Pineau e2a068d49b [Doc] Updated template_from_string to use include function
instead of include tag
2013-02-06 11:10:34 +01:00
Fabien Potencier 7c2479d47b tweaked previous merge 2013-01-15 20:56:11 +01:00
Mark Story c7dafb7e20 Update documentation for constant() 2013-01-10 23:40:58 -05:00
Fabien Potencier f4f88a51e2 added an include function 2012-12-17 08:43:49 +01:00
Fabien Potencier a59dcde3c2 added support for named arguments for filters, tests, and functions 2012-11-15 10:23:32 +01:00
Mario A. Alvarez Garcia cc65c8843a [template_from_string]Fixed typo 2012-11-07 14:59:42 -05:00
Fabien Potencier 459918827b added the template_from_string function 2012-10-29 11:42:14 +01:00
Fabien Potencier 4cd98e62d0 clarified usage of the dump function (closes #718) 2012-05-08 08:23:16 +02:00
Fabien Potencier e9cfd2ec85 fixed typos in the doc 2012-02-29 22:00:20 +01:00
Fabien Potencier 4dee4e5841 updated the CHANGELOG and documentation for previous merge 2012-02-15 17:29:31 +01:00
Fabien Potencier cbadac91cd tweaked doc 2012-01-26 13:25:31 +01:00
Tobias Schultze 2561aa212e typo 2012-01-26 12:48:04 +01:00
Tobias Schultze faa90c9268 updated doc for random function 2012-01-26 12:45:18 +01:00
Fabien Potencier 764829f55a added a date function to ease date comparison (closes #571) 2012-01-06 20:32:26 +01:00