Title: Deprecated Elements constantly throwing errors
Last modified: July 10, 2017

---

# Deprecated Elements constantly throwing errors

 *  [msarns](https://wordpress.org/support/users/msarns/)
 * (@msarns)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/deprecated-elements-constantly-throwing-errors/)
 * Twig/Timber framework dumped on us by graphic designers. Server is constantly
   generating errors about ‘function_wrapper is deprecated and will be removed in
   1.4’.
 * No documentation at all at twig.sensiolabs.org. No search on the page at twig.
   sensiolabs.org. Downloaded PDF, function_wrapper is not even documented.
 * Terrible framework for text-based maintenance too. Save me from the drag and 
   drop geniuses.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [gchtr](https://wordpress.org/support/users/gchtr/)
 * (@gchtr)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/deprecated-elements-constantly-throwing-errors/#post-9393800)
 * Hey [@msarns](https://wordpress.org/support/users/msarns/)
 * The `function_wrapper` function is not a feature of Twig itself, but rather an
   extension of Timber. That’s why you didn’t find anything about it in the Twig
   Documentation.
 * It was used to make PHP functions available when working in Twig files and was
   deprecated, because it was necessary only in earlier versions of Timber. Now,
   there are other ways to call PHP functions from Twig or make functions available
   to Twig. You can find a documentation for this in the [Functions Guide](https://timber.github.io/docs/guides/functions/)
   of the Timber Documentation.
 * To make the warnings go away, you will have to replace every occurrence of `function_wrapper`
   in your theme by either using `{{ function('function_you_want_to_call') }}` directly
   in your Twig file or using the `timber/twig` filter to [add a new function to the Twig Environment](https://timber.github.io/docs/guides/functions/#make-functions-available-in-twig).
 *  Thread Starter [msarns](https://wordpress.org/support/users/msarns/)
 * (@msarns)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/deprecated-elements-constantly-throwing-errors/#post-9395141)
 * Okay, Replacing the only instance:
 * $context[‘ninja_forms_display_form’] = TimberHelper::function_wrapper( ‘ninja_forms_display_form’);
 * with
 * $context[‘ninja_forms_display_form’] = TimberHelper::{{ function(‘ninja_forms_display_form’)}};
 * Yields:
 * ‘Parse error: syntax error, unexpected ‘{‘ in C:\Shares\…\page.php on line 84’
 * So very simple, except it does not work. I’ve been trying variations on this 
   for another 2 hours because you said it would work. Checking the link to Function
   Guide I see the example for how to add a function to the ‘context’ is:
 * $context[‘my_custom_function’] = new FunctionWrapper( ‘my_custom_function’, $
   array_of_arguments );
 * Which is exactly what I’ve got, which is throwing the error.
 *  [gchtr](https://wordpress.org/support/users/gchtr/)
 * (@gchtr)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/deprecated-elements-constantly-throwing-errors/#post-9395179)
 * Yeah, it could be a little confusing first. When you use `{{ function('function_you_want_to_call')}}`,
   you can put this **directly into your Twig file**.
 * I guess somewhere in a Twig file in your theme you do something like this:
 * `{{ ninja_forms_display_form(4) }}`
 * You can replace this with:
 * `{{ function('ninja_forms_display_form', 4) }}`
 * The first argument of `function()` is always the name of the function to call,
   followed by all the arguments you need to pass. In this example, you’d have to
   replace the `4` with whatever argument you used before.
 * You can then delete
 * `$context['ninja_forms_display_form'] = TimberHelper::function_wrapper( 'ninja_forms_display_form');`
 * from your PHP file. You don’t need it anymore.
 * I hope this clears things up.
    -  This reply was modified 8 years, 9 months ago by [gchtr](https://wordpress.org/support/users/gchtr/).
 *  Thread Starter [msarns](https://wordpress.org/support/users/msarns/)
 * (@msarns)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/deprecated-elements-constantly-throwing-errors/#post-9395251)
 * Thanks, giving up on getting the variable from the context and the options that
   were set up and instead putting the value in directly in the file got it to display.
   There’s only one form in the whole site setup, so that was probably some unnecessary
   elegance. I’ve cut the function call and there are now no errors.
 * Works. Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Deprecated Elements constantly throwing errors’ is closed to new replies.

 * ![](https://ps.w.org/timber-library/assets/icon-256x256.png?rev=1482054)
 * [Timber](https://wordpress.org/plugins/timber-library/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/timber-library/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/timber-library/)
 * [Active Topics](https://wordpress.org/support/plugin/timber-library/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/timber-library/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/timber-library/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [msarns](https://wordpress.org/support/users/msarns/)
 * Last activity: [8 years, 9 months ago](https://wordpress.org/support/topic/deprecated-elements-constantly-throwing-errors/#post-9395251)