Generate a ready-made html form for display to the user.

@throws \Throwable

@return string
487888
public function generateForm(): string
    {
        foreach ($this->fields as $field) {
            if (is_array($field)) {
                $this->renderGroup($field);
                continue;
            }

            $this->form .= $this->render($field);
        }

        return $this->form;
    }
650157
public function render()
    {
        $this->setupDefaultOptions();

        if (!empty($this->value)) {
            $this->attribute('data-initial-preview', $this->preview());
            $this->attribute('data-initial-caption', $this->initialCaption($this->value));

            $this->setupPreviewOptions();
        }

        $this->options(['overwriteInitial' => true]);

        $options = json_encode($this->options);

        $this->script = <<<EOT

$("input{$this->getElementClassSelector()}").fileinput({$options});

EOT;

        return parent::render();
    }
583199
protected function renderDataTable()
    {
        $html = "<table " . ($this->tableId ? "id=\"{$this->tableId}\" " : "") . "border=\"1\">\n<thead>\n\t<tr>\n";

        foreach ($this->allColumns as $name => $toDisplay) {
            if ($toDisplay !== false) {
                if ($name === 0) {
                    $name = 'value';
                }
                if ($this->translateColumnNames) {
                    $name = $this->translateColumnName($name);
                }
                $html .= "\t\t<th>$name</th>\n";
            }
        }

        $html .= "\t</tr>\n</thead>\n<tbody>\n";

        foreach ($this->tableStructure as $row) {
            $html .= "\t<tr>\n";
            foreach ($this->allColumns as $name => $toDisplay) {
                if ($toDisplay !== false) {
                    $value = "-";
                    if (isset($row[$name])) {
                        if (is_array($row[$name])) {
                            $value = "<pre>" . self::formatValueXml(var_export($row[$name], true)) . "</pre>";
                        } else {
                            $value = self::formatValueXml($row[$name]);
                        }
                    }

                    $html .= "\t\t<td>$value</td>\n";
                }
            }
            $html .= "\t</tr>\n";
        }

        $html .= "</tbody>\n</table>\n";

        return $html;
    }
749538
private function build() {

        $this -> fill();

        $html = '<input type="'. $this -> type .'"';
        
        foreach($this -> attributes as $attribute => $value) {
            $html .= ' ' . $attribute . '="'. Escape :: attr($value) .'"';
        }

        $html .= '>';

        return $html;
    }
386521
public function getHtml(): string
  {
    $ret = $this->prefix;
    $ret .= Html::generateElement('a', $this->attributes, $this->innerHtml, true);
    $ret .= $this->postfix;

    return $ret;
  }
149901
public function toHtml()
    {
        $context = ValueUtils::val($this->context);
        $this->environment->display($this->template, $context);
    }
151872
public function renderBegin()
	{
		foreach ($this->form->getControls() as $control) {
			$control->setOption(RendererOptions::_rendered, FALSE);
		}

		$prototype = $this->form->getElementPrototype();
		$prototype = $this->configElem('form', $prototype);

		if ($this->form->isMethod('get')) {
			$el = $prototype;
			/** @noinspection PhpUndefinedFieldInspection */
			$query = parse_url($el->action, PHP_URL_QUERY);
			/** @noinspection PhpUndefinedFieldInspection */
			$el->action = str_replace("?$query", '', $el->action);
			$s = '';
			foreach (preg_split('#[;&]#', $query, NULL, PREG_SPLIT_NO_EMPTY) as $param) {
				$parts = explode('=', $param, 2);
				$name = urldecode($parts[0]);
				if (!isset($this->form[ $name ])) {
					$s .= Html::el('input', ['type' => 'hidden', 'name' => $name, 'value' => urldecode($parts[1])]);
				}
			}

			return $el->startTag() . "\n$s";
		} else {
			return $prototype->startTag();
		}
	}
501822
public function getHtml(): string
  {
    $html = $this->prefix;
    $html .= Html::generateTag('span', $this->attributes);

    if (is_array($this->options))
    {
      // Normalize current value as a string.
      $valueAsString = Cast::toManString($this->value, '');

      foreach ($this->options as $option)
      {
        $inputAttributes = $this->inputAttributes($option);
        $labelAttributes = $this->labelAttributes($option);

        $labelAttributes['for'] = $inputAttributes['id'];

        $key         = $option[$this->keyKey];
        $keyAsString = Cast::toManString($key, '');
        $value       = ($this->optionsObfuscator) ? $this->optionsObfuscator->encode(Cast::toOptInt($key)) : $key;

        $inputAttributes['value']   = $value;
        $inputAttributes['checked'] = ($valueAsString===$keyAsString);

        $html .= Html::generateVoidElement('input', $inputAttributes);

        $html .= $this->labelPrefix;
        $html .= Html::generateElement('label',
                                       $labelAttributes,
                                       Cast::toOptString($option[$this->labelKey]),
                                       $this->labelIsHtml);
        $html .= $this->labelPostfix;
      }
    }

    $html .= '</span>';
    $html .= $this->postfix;

    return $html;
  }
1232850
public function html() {
        global $OUTPUT;

        if (!empty($this->initerrors)) {
            $warnings = '';
            foreach ($this->initerrors as $mesg) {
                $warnings .= $OUTPUT->notification($mesg);
            }
            return $warnings;
        }
        $table = new html_table();

        $table->head = $this->headers();

        $summary = $this->summary();
        if (!empty($summary)) {
            $table->summary = $summary;
        }

        // To be used for extra formatting.
        $this->index = 0;
        $this->total = count($this->items);

        foreach ($this->items as $item) {
            if ($this->index >= ($this->perpage * $this->page) &&
                $this->index < ($this->perpage * ($this->page + 1))) {
                $table->data[] = $this->format_line($item);
            }
            $this->index++;
        }

        $underlying = get_class($this);

        $data = new stdClass();
        $data->table = $table;
        $data->instance = $this;

        $buttonattr = array('class' => 'singleview_buttons submit');
        $buttonhtml = implode(' ', $this->buttons());

        $buttons = html_writer::tag('div', $buttonhtml, $buttonattr);
        $selectview = new select($this->courseid, $this->itemid, $this->groupid);

        $sessionvalidation = html_writer::empty_tag('input',
            array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));

        $html = $selectview->html();
        $html .= html_writer::tag('form',
            $buttons . html_writer::table($table) . $this->bulk_insert() . $buttons . $sessionvalidation,
            array('method' => 'POST')
        );
        $html .= $selectview->html();
        return $html;
    }
427360
private function throwableToHtml(\Throwable $throwable): string
    {
        if (!$this->isDebug) {
            return '';
        }

        return
            "<!DOCTYPE html>\n" .
            "<html lang=\"en\">\n" .
            "   <head>\n" .
            "      <meta charset=\"utf-8\">\n" .
            '      <title>' . htmlentities($throwable->getMessage()) . "</title>\n" .
            "      <style>\n" .
            "         html, body, h1, p, code, pre {margin:0; padding:0; font-size:16px; font-family:Arial, Helvetica, sans-serif; color:#555;}\n" .
            "         h1 {font-size:2em; margin:.5em; color:#338;}\n" .
            "         p, pre {font-size:1em; margin:1em;}\n" .
            "         pre, code {font-family:monospace; color:#000;}\n" .
            "      </style>\n" .
            "   </head>\n" .
            "   <body>\n" .
            '      <h1>' . htmlentities($throwable->getMessage()) . "</h1>\n" .
            "      <p>\n" .
            '         <code>' . htmlentities(get_class($throwable)) . '</code> was thrown from <code>' . htmlentities($throwable->getFile()) . ':' . htmlentities(strval($throwable->getLine())) . '</code> with message <code>' . htmlentities($throwable->getMessage()) . ' (' . htmlentities(strval($throwable->getCode())) . ")</code>\n" .
            "      </p>\n" .
            '      <pre>' . htmlentities($throwable->getTraceAsString()) . "</pre>\n" .
            "   </body>\n" .
            "</html>\n";
    }
550331
public function RenderControl () {
		$attrsStr = $this->renderControlAttrsWithFieldVars([
			'autoComplete',
		]);
		if (!$this->form->GetFormTagRenderingStatus()) 
			$attrsStr .= (strlen($attrsStr) > 0 ? ' ' : '')
				. 'form="' . $this->form->GetId() . '"';
		$formViewClass = $this->form->GetViewClass();
		return $formViewClass::Format(static::$templates->control, [
			'id'		=> $this->id,
			'name'		=> $this->name,
			'type'		=> $this->type,
			'value'		=> htmlspecialchars($this->value, ENT_QUOTES),
			'attrs'		=> strlen($attrsStr) > 0 ? ' ' . $attrsStr : '',
		]);
	}
856092
public function html()
    {
        if (!$this->hasContent() && !$this->isEditable()) {
            return '';
        }

        $content = $this->hasContent() ? $this->show() : $this->showDefault();

        // If the return data is a View then assign any parameters to it.
        if ($content instanceof View && !empty($this->viewParams)) {
            $content->with($this->viewParams);
        }

        return (string) $content;
    }
488115
public function render()
    {
        $render = '';
        try {
            $render = $this->getRenderer()->render('form', $this);
        } catch(\Exception $e){
            dd($e->getMessage());//@todo find a good way to warn the developper
        }

        return $render;
    }
1163864
public function generate(): string
    {
        $elements = [];
        foreach ($this->hiddens as $hidden) {
            $elements[] = $hidden;
        }
        foreach ($this->elements as $element) {
            /** @noinspection PhpUndefinedMethodInspection */
            $elements[] = $element->generate();
        }
        return Tags::form($elements, $this->attributes);
    }
1247257
public function output_html() {
        $adminroot = admin_get_root();
        $return = '<fieldset>'."\n".'<div class="clearer"><!-- --></div>'."\n";
        foreach($this->settings as $setting) {
            $fullname = $setting->get_full_name();
            if (array_key_exists($fullname, $adminroot->errors)) {
                $data = $adminroot->errors[$fullname]->data;
            } else {
                $data = $setting->get_setting();
                // do not use defaults if settings not available - upgrade settings handles the defaults!
            }
            $return .= $setting->output_html($data);
        }
        $return .= '</fieldset>';
        return $return;
    }
1023614
public function renderForm()
    {
        $template = $this->path() . DS . 'in.ctp';

        if (!file_exists($template)) {
            user_error(__d('wasabi_cms', 'Template "{0}" for module {1} not found.', $template, $this->name()));
        }

        $viewClass = WasabiCms::getTheme()->getClassNameForInitialization();
        /** @var View $view */
        $view = new $viewClass();
        $output = $view->element('Wasabi/Cms.module', [
            'template' => $template,
            'form' => $this
        ]);

        return $output;
    }
78660
public function render()
    {
        $this->getEventManager()->trigger(
            'formBeforeRender',
            $this,
            array(

            )
        );
        $output = parent::render();
        $this->getEventManager()->trigger(
            'formAfterRender',
            $this,
            array(
                'output' => &$output
            )
        );
        return $output;
    }