Skip to content

Commit

Permalink
Replaced deprecated global Twig functions (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
KoenvanWijnen committed Feb 5, 2020
1 parent a36b9a0 commit 0127666
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 8 additions & 6 deletions Twig/Extension/UploaderExtension.php
Expand Up @@ -3,8 +3,10 @@
namespace Oneup\UploaderBundle\Twig\Extension;

use Oneup\UploaderBundle\Templating\Helper\UploaderHelper;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

class UploaderExtension extends \Twig_Extension
class UploaderExtension extends AbstractExtension
{
protected $helper;

Expand All @@ -21,11 +23,11 @@ public function getName()
public function getFunctions()
{
return [
new \Twig_SimpleFunction('oneup_uploader_endpoint', [$this, 'endpoint']),
new \Twig_SimpleFunction('oneup_uploader_progress', [$this, 'progress']),
new \Twig_SimpleFunction('oneup_uploader_cancel', [$this, 'cancel']),
new \Twig_SimpleFunction('oneup_uploader_upload_key', [$this, 'uploadKey']),
new \Twig_SimpleFunction('oneup_uploader_maxsize', [$this, 'maxSize']),
new TwigFunction('oneup_uploader_endpoint', [$this, 'endpoint']),
new TwigFunction('oneup_uploader_progress', [$this, 'progress']),
new TwigFunction('oneup_uploader_cancel', [$this, 'cancel']),
new TwigFunction('oneup_uploader_upload_key', [$this, 'uploadKey']),
new TwigFunction('oneup_uploader_maxsize', [$this, 'maxSize']),
];
}

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -28,7 +28,8 @@
"symfony/http-foundation": "^3.0|^4.0",
"symfony/templating": "^3.0|^4.0",
"symfony/translation": "^3.0|^4.0",
"symfony/yaml": "^3.0|^4.0"
"symfony/yaml": "^3.0|^4.0",
"twig/twig": "^1.41|^2.10|^3.0"
},

"require-dev": {
Expand Down

0 comments on commit 0127666

Please sign in to comment.