[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Form/ -> FormFactory.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  
  10  namespace Joomla\CMS\Form;
  11  
  12  use Joomla\Database\DatabaseAwareTrait;
  13  
  14  // phpcs:disable PSR1.Files.SideEffects
  15  \defined('_JEXEC') or die;
  16  // phpcs:enable PSR1.Files.SideEffects
  17  
  18  /**
  19   * Default factory for creating Form objects
  20   *
  21   * @since  4.0.0
  22   */
  23  class FormFactory implements FormFactoryInterface
  24  {
  25      use DatabaseAwareTrait;
  26  
  27      /**
  28       * Method to get an instance of a form.
  29       *
  30       * @param   string  $name     The name of the form.
  31       * @param   array   $options  An array of form options.
  32       *
  33       * @return  Form
  34       *
  35       * @since   4.0.0
  36       */
  37      public function createForm(string $name, array $options = array()): Form
  38      {
  39          $form = new Form($name, $options);
  40  
  41          $form->setDatabase($this->getDatabase());
  42  
  43          return $form;
  44      }
  45  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer