Allow to select which method should be used to in "Create from URL feature"

This commit is contained in:
Jan Böhmer 2026-05-02 23:23:20 +02:00
parent a2b9ee764d
commit aac5b8e0be
7 changed files with 198 additions and 15 deletions

View file

@ -22,6 +22,7 @@ declare(strict_types=1);
*/
namespace App\Twig;
use App\Services\InfoProviderSystem\CreateFromUrlHelper;
use Twig\Attribute\AsTwigFunction;
use App\Settings\SettingsIcon;
use Symfony\Component\HttpFoundation\Request;
@ -34,7 +35,7 @@ use Twig\Extension\AbstractExtension;
final readonly class MiscExtension
{
public function __construct(private EventCommentNeededHelper $eventCommentNeededHelper)
public function __construct(private EventCommentNeededHelper $eventCommentNeededHelper, private CreateFromUrlHelper $fromUrlHelper)
{
}
@ -84,4 +85,14 @@ final readonly class MiscExtension
return $request->getBaseUrl().$request->getPathInfo().$qs;
}
/**
* Returns true if the from url provider is active, false otherwise.
* @return bool
*/
#[AsTwigFunction(name: 'create_from_url_active')]
public function create_from_url_active(): bool
{
return $this->fromUrlHelper->canCreateFromUrl();
}
}