/**
* 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;
}