mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
New extension for rules.
This commit is contained in:
parent
006c2ae186
commit
eef68c9b31
app
@ -12,6 +12,7 @@ use FireflyIII\Support\Twig\General;
|
||||
use FireflyIII\Support\Twig\Journal;
|
||||
use FireflyIII\Support\Twig\PiggyBank;
|
||||
use FireflyIII\Support\Twig\Translation;
|
||||
use FireflyIII\Support\Twig\Rule;
|
||||
use FireflyIII\Validation\FireflyValidator;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Twig;
|
||||
@ -44,6 +45,7 @@ class FireflyServiceProvider extends ServiceProvider
|
||||
Twig::addExtension(new Journal);
|
||||
Twig::addExtension(new Budget);
|
||||
Twig::addExtension(new Translation);
|
||||
Twig::addExtension(new Rule);
|
||||
}
|
||||
|
||||
/**
|
||||
|
42
app/Support/Twig/Rule.php
Normal file
42
app/Support/Twig/Rule.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace FireflyIII\Support\Twig;
|
||||
|
||||
use Twig_Extension;
|
||||
use Twig_SimpleFunction;
|
||||
|
||||
/**
|
||||
* Class Rule
|
||||
* @package FireflyIII\Support\Twig
|
||||
*/
|
||||
class Rule extends Twig_Extension
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function getFunctions()
|
||||
{
|
||||
$functions = [];
|
||||
|
||||
$functions[] = new Twig_SimpleFunction(
|
||||
'allJournalTriggers', function () {
|
||||
return [
|
||||
'store-journal' => trans('firefly.rule_trigger_store_journal'),
|
||||
'update-journal' => trans('firefly.rule_trigger_update_journal'),
|
||||
];
|
||||
}
|
||||
);
|
||||
|
||||
return $functions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the extension.
|
||||
*
|
||||
* @return string The extension name
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'FireflyIII\Support\Twig\Rule';
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user