You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.1 KiB
45 lines
1.1 KiB
2 years ago
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace PhpMyAdmin\Twig;
|
||
|
|
||
|
use PhpMyAdmin\Message;
|
||
|
use Twig\Extension\AbstractExtension;
|
||
|
use Twig\TwigFilter;
|
||
|
|
||
|
class MessageExtension extends AbstractExtension
|
||
|
{
|
||
|
/**
|
||
|
* Returns a list of filters to add to the existing list.
|
||
|
*
|
||
|
* @return TwigFilter[]
|
||
|
*/
|
||
|
public function getFilters()
|
||
|
{
|
||
|
return [
|
||
|
new TwigFilter(
|
||
|
'notice',
|
||
|
static function (string $string) {
|
||
|
return Message::notice($string)->getDisplay();
|
||
|
},
|
||
|
['is_safe' => ['html']]
|
||
|
),
|
||
|
new TwigFilter(
|
||
|
'error',
|
||
|
static function (string $string) {
|
||
|
return Message::error($string)->getDisplay();
|
||
|
},
|
||
|
['is_safe' => ['html']]
|
||
|
),
|
||
|
new TwigFilter(
|
||
|
'raw_success',
|
||
|
static function (string $string) {
|
||
|
return Message::rawSuccess($string)->getDisplay();
|
||
|
},
|
||
|
['is_safe' => ['html']]
|
||
|
),
|
||
|
];
|
||
|
}
|
||
|
}
|