Skip to content

Commit

Permalink
Merge pull request #1849 from bolt/feature/extension-twig-test
Browse files Browse the repository at this point in the history
Check if extension exists as a twig test
  • Loading branch information
bobdenotter authored Sep 15, 2020
2 parents 6671a3a + fee03a2 commit 589a104
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Twig/ExtensionExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Tightenco\Collect\Support\Collection;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
use Twig\TwigTest;

/**
* Widget functionality Twig extension.
Expand All @@ -22,6 +23,13 @@ public function __construct(ExtensionRegistry $registry)
$this->registry = $registry;
}

public function getTests()
{
return [
new TwigTest('extension', [$this, 'extensionExists']),
];
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit 589a104

Please sign in to comment.