Using $UserDefinedForm in the Content area of the page shows
where the form should be rendered into. If it does not exist
then default back to $Form.

@return array
18668
public function index(HTTPRequest $request = null)
    {
        $form = $this->Form();
        if ($this->Content && $form && !$this->config()->disable_form_content_shortcode) {
            $hasLocation = stristr($this->Content, '$UserDefinedForm');
            if ($hasLocation) {
                /** @see Requirements_Backend::escapeReplacement */
                $formEscapedForRegex = addcslashes($form->forTemplate(), '\\$');
                $content = preg_replace(
                    '/(<p[^>]*>)?\\$UserDefinedForm(<\\/p>)?/i',
                    $formEscapedForRegex,
                    $this->Content
                );
                return [
                    'Content' => DBField::create_field('HTMLText', $content),
                    'Form' => ''
                ];
            }
        }

        return [
            'Content' => DBField::create_field('HTMLText', $this->Content),
            'Form' => $this->Form()
        ];
    }
399279
public function definition() {
        $mform = $this->_form;

        $mform->addElement('header', 'database', get_string('dbexport', 'tool_dbtransfer'));
        $mform->addElement('textarea', 'description', get_string('description'), array('rows'=>5, 'cols'=>60));
        $mform->setType('description', PARAM_TEXT);

        $this->add_action_buttons(false, get_string('exportdata', 'tool_dbtransfer'));
    }
991355
public function definition() {
        $mform = $this->_form;
        $instance = $this->_customdata;
        $dirtyclass = array('class' => 'ignoredirty');

        $mform->addElement('header', 'general', get_string('gradingoptions', 'assign'));
        // Visible elements.
        $options = array(-1 => get_string('all'), 10 => '10', 20 => '20', 50 => '50', 100 => '100');
        $maxperpage = get_config('assign', 'maxperpage');
        if (isset($maxperpage) && $maxperpage != -1) {
            unset($options[-1]);
            foreach ($options as $val) {
                if ($val > $maxperpage) {
                    unset($options[$val]);
                }
            }
        }
        $mform->addElement('select', 'perpage', get_string('assignmentsperpage', 'assign'), $options, $dirtyclass);
        $options = array('' => get_string('filternone', 'assign'),
                         ASSIGN_FILTER_NOT_SUBMITTED => get_string('filternotsubmitted', 'assign'),
                         ASSIGN_FILTER_SUBMITTED => get_string('filtersubmitted', 'assign'),
                         ASSIGN_FILTER_REQUIRE_GRADING => get_string('filterrequiregrading', 'assign'),
                         ASSIGN_FILTER_GRANTED_EXTENSION => get_string('filtergrantedextension', 'assign'));
        if ($instance['submissionsenabled']) {
            $mform->addElement('select', 'filter', get_string('filter', 'assign'), $options, $dirtyclass);
        }
        if (!empty($instance['markingallocationopt'])) {
            $markingfilter = get_string('markerfilter', 'assign');
            $mform->addElement('select', 'markerfilter', $markingfilter, $instance['markingallocationopt'], $dirtyclass);
        }
        if (!empty($instance['markingworkflowopt'])) {
            $workflowfilter = get_string('workflowfilter', 'assign');
            $mform->addElement('select', 'workflowfilter', $workflowfilter, $instance['markingworkflowopt'], $dirtyclass);
        }
        // Quickgrading.
        if ($instance['showquickgrading']) {
            $mform->addElement('checkbox', 'quickgrading', get_string('quickgrading', 'assign'), '', $dirtyclass);
            $mform->addHelpButton('quickgrading', 'quickgrading', 'assign');
            $mform->setDefault('quickgrading', $instance['quickgrading']);
        }

        // Show active/suspended user option.
        if ($instance['showonlyactiveenrolopt']) {
            $mform->addElement('checkbox', 'showonlyactiveenrol', get_string('showonlyactiveenrol', 'grades'), '', $dirtyclass);
            $mform->addHelpButton('showonlyactiveenrol', 'showonlyactiveenrol', 'grades');
            $mform->setDefault('showonlyactiveenrol', $instance['showonlyactiveenrol']);
        }

        // Place student downloads in seperate folders.
        if ($instance['submissionsenabled']) {
            $mform->addElement('checkbox', 'downloadasfolders', get_string('downloadasfolders', 'assign'), '', $dirtyclass);
            $mform->addHelpButton('downloadasfolders', 'downloadasfolders', 'assign');
            $mform->setDefault('downloadasfolders', $instance['downloadasfolders']);
        }

        // Hidden params.
        $mform->addElement('hidden', 'contextid', $instance['contextid']);
        $mform->setType('contextid', PARAM_INT);
        $mform->addElement('hidden', 'id', $instance['cm']);
        $mform->setType('id', PARAM_INT);
        $mform->addElement('hidden', 'userid', $instance['userid']);
        $mform->setType('userid', PARAM_INT);
        $mform->addElement('hidden', 'action', 'saveoptions');
        $mform->setType('action', PARAM_ALPHA);

        // Buttons.
        $this->add_action_buttons(false, get_string('updatetable', 'assign'));
    }
820002
public function renderBegin()
	{
		if($this->getParent() instanceof self)
			return '';
		else
		{
			$options=$this->activeForm;
			if(isset($options['class']))
			{
				$class=$options['class'];
				unset($options['class']);
			}
			else
				$class='CActiveForm';
			$options['action']=$this->action;
			$options['method']=$this->method;
			if(isset($options['htmlOptions']))
			{
				foreach($this->attributes as $name=>$value)
					$options['htmlOptions'][$name]=$value;
			}
			else
				$options['htmlOptions']=$this->attributes;
			ob_start();
			$this->_activeForm=$this->getOwner()->beginWidget($class, $options);
			return ob_get_clean() . "<div style=\"display:none\">".CHtml::hiddenField($this->getUniqueID(),1)."</div>\n";
		}
	}
666514
public function onModelFormRenderControlWrapper()
    {
        $type = Input::get('controlType');
        $controlId = Input::get('controlId');
        $properties = Input::get('properties');

        $controlInfo = $this->getControlInfo($type);

        return [
            'markup' => $this->renderControlWrapper($type, $properties),
            'controlId' => $controlId,
            'controlTitle' => Lang::get($controlInfo['name']),
            'description' => Lang::get($controlInfo['description']),
            'type' => $type
        ];
    }
1096155
public function get_initial_form_data() {
        $toform = new stdClass();
        $toform->attempts   = $this->attempts;
        $toform->onlygraded = $this->onlygraded;
        $toform->pagesize   = $this->pagesize;

        if ($this->states) {
            foreach (self::$statefields as $field => $state) {
                $toform->$field = in_array($state, $this->states);
            }
        }

        return $toform;
    }
453681
public function getPostReset()
    {
        $form       = new UserResetForm($this->di);
        $form->check();

        $views = [
            ["comment/user/pre/reset", ["form" => $form->getHTML()], "main"]
        ];

        $this->di->get("pageRenderComment")->renderPage([
            "views" => $views,
            "title" => "Reset password"
        ]);
    }
559514
protected function getUserDefinedGlobals()
    {
        if (file_exists(realpath(__DIR__.'/../../../../config/twig.php'))) {
            $this->config = require realpath(__DIR__.'/../../../../config/twig.php');
        } elseif (file_exists(realpath(__DIR__.'/../config/twig.php'))) {
            $this->config = require realpath(__DIR__.'/../config/twig.php');
        }

        return isset($this->config['twig_global']) ? $this->config['twig_global'] : [];
    }
869989
public function render()
    {
        // transform selected values into the format used by TCEforms
        $selectedValues = $this->selectedValues;
        $tablesToIndex = $this->getIndexQueueConfigurationTableMap();

        $formField = $this->renderSelectCheckbox($this->buildSelectorItems($tablesToIndex), $selectedValues);

        // need to wrap the field in a TCEforms table to make the CSS apply
        $form[] = '<div class="typo3-TCEforms tx_solr-TCEforms">';
        $form[] = $formField;
        $form[] = '</div>';

        return implode(LF, $form);
    }
697319
public function definition() {

        $mform = $this->_form;
        $mform->disable_form_change_checker();
        $componentarray = $this->_customdata['components'];
        $edulevelarray = $this->_customdata['edulevel'];
        $crudarray = $this->_customdata['crud'];

        $mform->addElement('header', 'displayinfo', get_string('filter', 'report_eventlist'));

        $mform->addElement('text', 'eventname', get_string('name', 'report_eventlist'));
        $mform->setType('eventname', PARAM_RAW);

        $mform->addElement('select', 'eventcomponent', get_string('component', 'report_eventlist'), $componentarray);
        $mform->addElement('select', 'eventedulevel', get_string('edulevel', 'report_eventlist'), $edulevelarray);
        $mform->addElement('select', 'eventcrud', get_string('crud', 'report_eventlist'), $crudarray);

        $buttonarray = array();
        $buttonarray[] = $mform->createElement('button', 'filterbutton', get_string('filter', 'report_eventlist'));
        $buttonarray[] = $mform->createElement('button', 'clearbutton', get_string('clear', 'report_eventlist'));
        $mform->addGroup($buttonarray, 'filterbuttons', '', array(' '), false);
    }
308691
public function definition() {
        $mform = $this->_form;

        $mform->addElement('text', 'name', get_string('name'), 'maxlength="100"');
        $mform->setType('name', PARAM_TEXT);
        $mform->addRule('name', get_string('required'), 'required', null, 'server');
        $mform->addRule('name', get_string('maximumchars', '', 100), 'maxlength', 100, 'server');

        $mform->addElement('editor', 'description', get_string('description'), null, ['autosave' => false]);
        $mform->setType('description', PARAM_CLEANHTML);

        if (!empty($this->_customdata['showbuttons'])) {
            if (!$this->get_persistent()->get('id')) {
                $savetext = get_string('add');
            } else {
                $savetext = get_string('savechanges');
            }
            $this->add_action_buttons(true, $savetext);
        }
    }
480244
public function getFromForm()
    {
        if ($this->form !== null) {
            $this->user_id = $this->form->user_id;
            $this->phone = $this->form->phone;
            $this->code = $this->form->code;
            $this->type_id = $this->form->type_id;
            $this->ip = $this->form->ip;
            $this->is_used = $this->form->is_used;
            $this->is_validated = $this->form->is_validated;
            $this->is_deleted = $this->form->is_deleted;
        }
    }
920266
public function definition() {
        global $SESSION; // This is very hacky :-(.

        $mform       =& $this->_form;
        $fields      = $this->_customdata['fields'];
        $extraparams = $this->_customdata['extraparams'];

        if (!empty($SESSION->user_filtering)) {
            // Add controls for each active filter in the active filters group.
            $mform->addElement('header', 'actfilterhdr', get_string('actfilterhdr', 'filters'));

            foreach ($SESSION->user_filtering as $fname => $datas) {
                if (!array_key_exists($fname, $fields)) {
                    continue; // Filter not used.
                }
                $field = $fields[$fname];
                foreach ($datas as $i => $data) {
                    $description = $field->get_label($data);
                    $mform->addElement('checkbox', 'filter['.$fname.']['.$i.']', null, $description);
                }
            }

            if ($extraparams) {
                foreach ($extraparams as $key => $value) {
                    $mform->addElement('hidden', $key, $value);
                    $mform->setType($key, PARAM_RAW);
                }
            }

            $objs = array();
            $objs[] = &$mform->createElement('submit', 'removeselected', get_string('removeselected', 'filters'));
            $objs[] = &$mform->createElement('submit', 'removeall', get_string('removeall', 'filters'));
            $mform->addElement('group', 'actfiltergrp', '', $objs, ' ', false);
        }
    }
1335338
public function RenderBegin () {
		$this->form->PreDispatch();
		$result = "<form";
		$attrs = [];
		$form = & $this->form;
		// standard attributes
		$formProperties = ['id', 'action', 'method', 'enctype', 'target'];
		foreach ($formProperties as $property) {
			$getter = 'Get'.ucfirst($property);
			$formPropertyValue = $form->$getter();
			if ($formPropertyValue !== NULL)
				$attrs[$property] = $formPropertyValue;
		}
		// css classes
		$formCssClasses = $form->GetCssClasses();
		if ($formCssClasses)
			$attrs['class'] = gettype($formCssClasses) == 'array'
				? implode(' ', (array) $formCssClasses)
				: $formCssClasses;
		// additional custom attributes completing
		foreach ($form->GetAttributes() as $key => $value) {
			if (!in_array($key, $formProperties))
				$attrs[$key] = $value;
		}
		// pseudo-boolean attributes completing
		$formAutoComplete = $form->GetAutoComplete();
		if ($formAutoComplete !== NULL) 
			$attrs['autocomplete'] = $formAutoComplete ? 'on' : 'off';
		$formNoValidate = $form->GetNoValidate();
		if ($formNoValidate === TRUE)
			$attrs['novalidate'] = 'novalidate';
		$formAcceptCharsets = $form->GetAcceptCharsets();
		if (count($formAcceptCharsets) > 0) 
			$attrs['accept-charset'] = implode(' ', $formAcceptCharsets);
		// boolean and additional attributes
		$attrsStr = self::RenderAttrs($attrs);
		if ($attrsStr) $result .= ' ' . $attrsStr;
		$result .= '>';
		$this->form->SetFormTagRenderingStatus(TRUE);
		$result .= $this->RenderCsrf();
		return $result;
	}
534585
public function getPostEditSecurity()
    {
        $name = $this->di->get('session')->get("user");
        $user = $this->getUserDetails($name);

        $form       = new UpdateProfileSecurityForm($this->di);
        $form->check();

        $views = [
            ["comment/user/profile/edit", ["form" => $form->getHTML(), "user" => $user], "main"]
        ];

        $this->di->get("pageRenderComment")->renderPage([
            "views" =>  $views,
            "title" => "Edit Profile"
        ]);
    }
1071333
public function getDefaultPages()
    {
        if ($this->defaultPages != null) {
            return $this->defaultPages;
        }
        $this->defaultPages = [];
        /** @noinspection PhpUndefinedFieldInspection */
        if ($this->configFile->defaultPages->getName()) {
            /** @noinspection PhpUndefinedFieldInspection */
            foreach ($this->configFile->defaultPages->page as $page) {
                $title = (string)$page;
                $this->defaultPages[$title]["template"] = (string)$page["template"];
                $this->defaultPages[$title]["alias"] = (string)$page["alias"];
                $this->defaultPages[$title]["id"] = (string)$page["id"];
            }

        }

        return $this->defaultPages;
    }
73110
public function editAction()
    {
        $entity = $this->getUser();

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find User entity.');
        }

        $editForm = $this->createEditForm($entity);

        return array(
            'entity' => $entity,
            'edit_form' => $editForm->createView(),
        );
    }