Added:
- ContentSource handling in message - ContentSource list, add/update ui - nextPageSelector and imageSelector can be null - cleanup
This commit is contained in:
28
src/Twig/Extension/AppExtension.php
Normal file
28
src/Twig/Extension/AppExtension.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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 => '',
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user