Files
Mangarr/src/Twig/Extension/AppExtension.php
Jérémy Guillot 3012adfee7 Added:
- ContentSource handling in message
- ContentSource list, add/update ui
- nextPageSelector and imageSelector can be null
- cleanup
2024-06-30 20:47:27 +02:00

29 lines
744 B
PHP

<?php
namespace App\Twig\Extension;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
class AppExtension extends AbstractExtension
{
public function getFunctions(): array
{
return [
new TwigFunction('get_placeholder', [$this, 'getPlaceholder']),
];
}
public function getPlaceholder(string $fieldName): string
{
return match ($fieldName) {
'baseUrl' => 'https://example.com',
'imageSelector' => '.manga-image img',
'chapterUrlFormat' => 'https://example.com/manga/{slug}/chapter-{number}',
'nextPageSelector' => '.next-page',
'scrapingType' => 'Select scraping type',
default => '',
};
}
}