FormFactory.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php declare(strict_types=1);
  2. namespace Grav\Plugin\Form;
  3. use Grav\Common\Page\Interfaces\PageInterface;
  4. use Grav\Common\Page\Page;
  5. use Grav\Framework\Form\Interfaces\FormFactoryInterface;
  6. use Grav\Framework\Form\Interfaces\FormInterface;
  7. class FormFactory implements FormFactoryInterface
  8. {
  9. /**
  10. * Create form using the header of the page.
  11. *
  12. * @param Page $page
  13. * @param string $name
  14. * @param array $form
  15. * @return Form|null
  16. * @deprecated 1.6 Use FormFactory::createFormByPage() instead.
  17. */
  18. public function createPageForm(Page $page, string $name, array $form): ?FormInterface
  19. {
  20. return new Form($page, $name, $form);
  21. }
  22. /**
  23. * Create form using the header of the page.
  24. *
  25. * @param PageInterface $page
  26. * @param string $name
  27. * @param array $form
  28. * @return Form|null
  29. */
  30. public function createFormForPage(PageInterface $page, string $name, array $form): ?FormInterface
  31. {
  32. return new Form($page, $name, $form);
  33. }
  34. }