. // }}} /** * Handle network public feed * * @package GNUsocial * @category Wrapper * * @author Hugo Sales * @copyright 2020 Free Software Foundation, Inc http://www.fsf.org * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ namespace App\Core; use Symfony\Component\Form\Form as SymfForm; use Symfony\Component\Form\FormFactoryInterface; abstract class Form { private static ?FormFactoryInterface $form_factory; public static function setFactory($ff): void { self::$form_factory = $ff; } public static function create(array $form, string $type = 'Symfony\Component\Form\Extension\Core\Type\FormType', array $options = null): SymfForm { $fb = self::$form_factory->createBuilder($type, $options ?: ['translation_domain' => false]); foreach ($form as $f) { $fb->add(...$f); } return $fb->getForm(); } }