FormFactory.php 1.0 KB

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