Back to SubformField class

Method loadSubForm

public \Joomla\CMS\Form\Form
loadSubForm
()
Loads the form instance for the subform.
Returns
  • \Joomla\CMS\Form\Form The form instance.
Since
  • 3.9.7
-
  • \InvalidArgumentException if no form provided.
  • \RuntimeException if the form could not be loaded.
Class: SubformField
Project: Joomla

Method loadSubForm - Source code

/**
 * Loads the form instance for the subform.
 *
 * @return  Form  The form instance.
 *
 * @throws  \InvalidArgumentException if no form provided.
 * @throws  \RuntimeException if the form could not be loaded.
 *
 * @since   3.9.7
 */
public function loadSubForm()
{
    $control = $this->name;
    if ($this->multiple) {
        $control .= '[' . $this->fieldname . 'X]';
    }
    // Prepare the form template
    $formname = 'subform.' . str_replace(array('jform[', '[', ']'), array('', '.', ''), $this->name);
    $tmpl = Form::getInstance($formname, $this->formsource, array('control' => $control));
    return $tmpl;
}