mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-11 07:22:12 +00:00
Allow to select which method should be used to in "Create from URL feature"
This commit is contained in:
parent
a2b9ee764d
commit
aac5b8e0be
7 changed files with 198 additions and 15 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue