mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-12 21:29:33 +00:00
26 lines
No EOL
536 B
PHP
26 lines
No EOL
536 B
PHP
<?php
|
|
|
|
namespace App\Twig;
|
|
|
|
use Twig\Extension\AbstractExtension;
|
|
use Twig\TwigFunction;
|
|
|
|
class AssemblyTwigExtension extends AbstractExtension
|
|
{
|
|
public function getFunctions(): array
|
|
{
|
|
return [
|
|
new TwigFunction('has_assembly', [$this, 'hasAssembly']),
|
|
];
|
|
}
|
|
|
|
public function hasAssembly(array $bomEntries): bool
|
|
{
|
|
foreach ($bomEntries as $entry) {
|
|
if ($entry->getAssembly() !== null) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
} |