Expand rule/search combination.

This commit is contained in:
James Cole
2020-08-27 20:22:52 +02:00
parent 2393344978
commit 8c97754b64
6 changed files with 142 additions and 8 deletions

View File

@@ -26,6 +26,7 @@ use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Support\Search\OperatorQuerySearch;
use League\CommonMark\CommonMarkConverter;
use Route;
use Twig\Extension\AbstractExtension;
@@ -64,9 +65,20 @@ class General extends AbstractExtension
$this->formatDate(),
$this->getMetaField(),
$this->hasRole(),
$this->getRootSearchOperator(),
];
}
protected function getRootSearchOperator(): TwigFunction
{
return new TwigFunction(
'getRootSearchOperator',
static function (string $operator): string {
return OperatorQuerySearch::getRootOperator($operator);
}
);
}
/**
* Will return "active" when a part of the route matches the argument.
* ie. "accounts" will match "accounts.index".