mirror of
https://github.com/Aviortheking/DeltaCMS.git
synced 2025-07-03 10:09:19 +00:00
Added Input objects
This commit is contained in:
33
src/AdminPanel/Form/EntityInput.php
Normal file
33
src/AdminPanel/Form/EntityInput.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace AdminPanel\Form;
|
||||
|
||||
use AdminPanel\AdminPanel;
|
||||
|
||||
class EntityInput implements Input
|
||||
{
|
||||
public function getOptions(): array
|
||||
{
|
||||
return array(
|
||||
'label',
|
||||
'entity'
|
||||
);
|
||||
}
|
||||
|
||||
public function processOption(string $optionName, $value): array
|
||||
{
|
||||
if ($optionName === 'entity') {
|
||||
return array(
|
||||
'entities' => AdminPanel::getInstance()->getEm()->getRepository($value)->findAll()
|
||||
);
|
||||
}
|
||||
return array(
|
||||
$optionName => $value
|
||||
);
|
||||
}
|
||||
|
||||
public function getTemplate(): string
|
||||
{
|
||||
return "@AdminPanel/form/entity.twig";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user