Craft\FormBuilder2Variable::getFormHtmlById PHP Method

getFormHtmlById() public method

Get Form By Id
public getFormHtmlById ( $formId )
    public function getFormHtmlById($formId)
    {
        $form = craft()->formBuilder2_form->getFormById($formId);
        $oldPath = craft()->templates->getTemplatesPath();
        $variables['formId'] = $form;
        craft()->templates->setTemplatesPath(craft()->path->getPluginsPath() . 'formbuilder2/templates');
        $html = craft()->templates->render('/forms/frontend', $variables);
        craft()->templates->setTemplatesPath($oldPath);
        return $html;
    }