- 🇫🇷France prudloff Lille
In order to maintain backward compatibility,
$context
should be the last parameter inFilterInterface::process()
and should be optional.
The current filtering system is a global based filtering system such as filtering urls, converting \n to <p>, <br/> which is really good, but in doing some complex things such as quickly rendering some information from the current node is not always possible since there is no direct link between the text being filtered and the entity (node, comment, transaction etc) which is comes from.
One example of this is when using the PHP filter to build some text on node, to get the current node you need use the url, or the menu system to get the node object, which is fine on the when your url is node/xxx but when you are viewing a list of nodes, this is not possible.
This patch adds context to the current filtering system so that when you are filtering the text you also have access to the entity or any other variables that are relevant. So when rendering a text field, the filters will also have access to the node (if this field is on a node) directly.
This also opens the possibility to use less security problematic filters such as the PHP filter. Since Twig will be in core (fingers crossed), instead of using the PHP filter, we can use Twig to filter variables, and even control blocks and loops. Since Twig is all sandboxed, the ability to give access to a filter with much more control without the security implications.
#1996922: Twig Filter →
✨
Token Filter
Needs work
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
In order to maintain backward compatibility, $context
should be the last parameter in FilterInterface::process()
and should be optional.