createFormForPage($page, $name, $form); } /** * @param PageInterface $page * @param string $name * @param array $form * @return FormInterface|null */ public function createFormForPage(PageInterface $page, string $name, array $form): ?FormInterface { $formFlex = $form['flex'] ?? []; $type = $formFlex['type'] ?? ''; $key = $formFlex['key'] ?? ''; $layout = $formFlex['layout'] ?? $name; /** @var Flex $flex */ $flex = Grav::instance()['flex_objects']; $object = $flex->getObject($key, $type); return $object ? $object->getForm($layout, ['form' => $form]) : null; } }