Returns the form element as an HTML tag

@return string
670
public function outputElement() : string
    {
        $selected = explode(',', $this->getValue());
        $disabled = $this->disabled;
        $hidden = $this->hidden;

        $return = '<div class="checkboxgroup">';
        foreach ($this->options as $val=>$txt) {
            if (in_array($val, $hidden)) {
                break;
            }
            $d = (in_array($val, $disabled)) ? ' disabled="disabled"' : '';
            $s = (in_array($val, $selected)) ? ' checked="checked"' : '';
            $return .= '<div><input id="cb-' . $val . '" type="checkbox" name="' . $this->attributes['name'] . '[]" value="' . $val . '" ' . $d . $s . ' /> <label class="cblabel" for="cb-' . $val . '">' . $txt . "</label></div>\n";
        }
        $return .= '</div>';

        return $return;
    }
504915
public function html() {
    if (($el = $this->getElement()) === NULL) return NULL;
    
    return implode('',xml::export($el->childNodes));
  }
337359
public function getElement()
    {
        if ($this->getDocblock()) {
            $this->setLines($this->getDocblock()->getElement());
        }

        $name = '';
        if ($this->getName() and !is_array($this->getValue())) {
            $name = ($this->getType() ? $this->getType().' ' : '')
                .'$'.$this->getName().
                ($this->getValue() ? ' = '.$this->getValue() : '').';';
            $this->addLine($name);
        } else if ($this->getName() and is_array($this->getValue())) {
            $value = $this->getValue();
            $begin = array_shift($value);
            $end = array_pop($value);
            $value[] = $end.';';
            $this->addLine(($this->getType() ? $this->getType().' ' : '').'$'.$this->getName().' = '.$begin);
            $this->addLine($value);
        }


        return $this->getLines();
    }
877076
public function getSubmittingElement() {

		// cache submitting element

		if(!empty($this->clickedSubmit)) {
			return $this->clickedSubmit;
		}

		if(is_null($this->requestValues)) {
			return null;
		}

		foreach($this->elements as $name => $e) {

			if(is_array($e)) {

				// parse one-dimensional arrays

				foreach($this->requestValues->keys() as $k) {

					if(preg_match('/^' . $name . '\\[(.*?)\\]$/', $k, $m)) {

						if(isset($this->elements[$name][$m[1]]) && $this->elements[$name][$m[1]]->canSubmit()) {

							$this->clickedSubmit = $this->elements[$name][$m[1]];
							return $this->clickedSubmit;

						}
					}

				}

				foreach($e as $k => $ee) {

					if(
						$ee instanceof ImageElement &&
						($arr = $this->requestValues->get($name . '_x')) &&
						isset($arr[$k])
					) {
						$this->clickedSubmit = $ee;
						return $ee;
					}

					else if(
						$ee->canSubmit() &&
						($arr = $this->requestValues->get($name)) &&
						isset($arr[$k])
					) {
						$this->clickedSubmit = $ee;
						return $ee;
					}
				}
			}

			else if($e instanceof ImageElement && !is_null($this->requestValues->get($name . '_x'))) {
				$this->clickedSubmit = $e;
				return $e;
			}
			else if($e->canSubmit() && !is_null($this->requestValues->get($name))) {
				$this->clickedSubmit = $e;
				return $e;
			}

		}
	}
1345445
protected function getInputTag()
    {
        $tag = new SwatHtmlTag('input');
        $tag->type = 'text';
        $tag->name = $this->autocomplete ? $this->id : $this->getNonce();
        $tag->id = $this->autocomplete ? $this->id : $this->getNonce();
        $tag->class = $this->getCSSClassString();

        // event handlers to select on focus
        if ($this->select_on_focus) {
            $tag->onmousedown = 'if(!this._focused){this._focus_click=true;}';
            $tag->onmouseup =
                'if(this._focus_click){' .
                'this.select();this._focus_click=false;}';

            $tag->onfocus =
                'this._focused=true;' .
                'if(!this._focus_click){this.select();}';

            $tag->onblur = 'this._focused=false;this._focus_click=false;';
        }

        if ($this->read_only) {
            $tag->readonly = 'readonly';
        }

        if (!$this->isSensitive()) {
            $tag->disabled = 'disabled';
        }

        $value = $this->getDisplayValue($this->value);

        // escape value for display because we actually want to show entities
        // for editing
        $value = htmlspecialchars($value);
        $tag->value = $value;

        $tag->size = $this->size;
        $tag->maxlength = $this->maxlength;
        $tag->accesskey = $this->access_key;
        $tag->tabindex = $this->tab_index;

        if ($this->placeholder != '') {
            $tag->placeholder = $this->placeholder;
        }

        return $tag;
    }
1151731
public function render()
    {
        $this->tag = '<' . $this->name;

        if (count($this->attr)) {
            $this->tag .= ' ';
            foreach ($this->attr as $key => $value) {
                $this->tag .= $key . '="';
                if (is_array($value)) {
                    $this->tag .= implode(' ', $value);
                } else {
                    $this->tag .= $value != false? $value: 0;
                }
                $this->tag .= '" ';
            }
        }
        $this->tag = trim($this->tag) . '>';

        if (!in_array(strtolower($this->name), $this->elementsNoClosing)) {
            $this->tag .= $this->parseValue($this->value) . '</' . $this->name . '>';
        }

        return $this->tag;
    }
1369818
public function getElement()
    {
        $this->startCommentBlock();
        foreach ($this->description as $line) {
            $this->addLine($line);
        }
        $this->addBlankLine();

        if (count($this->var_types) > 0) {
            $type_ltgh = max(array_map('mb_strlen', $this->var_types));
            $var_ltgh = max(array_map('mb_strlen', array_keys($this->var_types)));
            foreach ($this->var_types as $name => $type) {
                $type = str_pad($type, $type_ltgh);
                $param = str_pad($name, $var_ltgh);
                $this->addLine('@param '.$type.'$'.$param.' '.$this->var_descriptions[$name]);
            }
            $this->addBlankLine();
        }

        if (count($this->params) > 0) {
            $params_ltgh = array_map('strlen', array_keys($this->params));
            foreach ($this->params as $param => $value) {
                $this->addLine('@'.str_pad($param, max($params_ltgh)).' '.$value);
            }
        }

        $this->endCommentBlock();
        return $this->lines;
    }
1348321
protected function getInput()
	{
		$html = array();

		// Initialize some field attributes.
		$class = $this->element['class'] ? ' class="checkboxes ' . (string) $this->element['class'] . '"' : ' class="checkboxes"';
		$checkedOptions = explode(',', (string) $this->element['checked']);

		// Start the checkbox field output.
		$html[] = '<fieldset id="' . $this->id . '"' . $class . '>';

		// Get the field options.
		$options = $this->getOptions();

		// Build the checkbox field output.
		$html[] = '<ul>';

		foreach ($options as $i => $option)
		{
			// Initialize some option attributes.
			if (!isset($this->value) || empty($this->value))
			{
				$checked = (in_array((string) $option->value, (array) $checkedOptions) ? ' checked="checked"' : '');
			}
			else
			{
				$value = !is_array($this->value) ? explode(',', $this->value) : $this->value;
				$checked = (in_array((string) $option->value, $value) ? ' checked="checked"' : '');
			}

			$class = !empty($option->class) ? ' class="' . $option->class . '"' : '';
			$disabled = !empty($option->disable) ? ' disabled="disabled"' : '';

			// Initialize some JavaScript option attributes.
			$onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : '';
			$label   = $this->translateLabel ? $this->getText()->translate($option->text) : $option->text;

			$html[] = '<li>';
			$html[] = '<input type="checkbox" id="' . $this->id . $i . '" name="' . $this->name . '"' . ' value="'
				. htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $onclick . $disabled . '/>';

			$html[] = '<label for="' . $this->id . $i . '"' . $class . '>' . $label . '</label>';
			$html[] = '</li>';
		}

		$html[] = '</ul>';

		// End the checkbox field output.
		$html[] = '</fieldset>';

		return implode($html);
	}
1027213
private function renderForm(Form $form) : string
    {
        $html = '';

        foreach ($form->getComponents() as $component) {
            $html .= $this->renderErrors($component);

            if ($component instanceof Element) {
                $html .= $this->renderElement($component);
            } elseif ($component instanceof Group) {
                foreach ($component->getElements() as $element) {
                    $html .= $this->renderElement($element);
                }
            }
        }

        return $html;
    }
1250005
function toHTML()
    {

        return '<div class="captcha-container"><img src="' . $this->form_properties['assets_url'] . 'process.php?captcha=' . ($this->form_properties['captcha_storage'] == 'session' ? 2 : 1) . '&amp;nocache=' . time() . '" alt=""' . ($this->form_properties['doctype'] == 'xhtml' ? '/' : '') . '><a href="javascript:void(0)" title="' . $this->form_properties['language']['new_captcha'] . '">' . $this->form_properties['language']['new_captcha'] . '</a></div>';
    
    }
1122923
public function renderForm(Form $form)
	{
		$content = '';
		foreach ($form as $element)
		{
			$content .= $this->render($element);
		}

		$form->setAttribute('role', 'form');

		return Html::tag('form', $form->getAttributes(), $content);
	}
90971
protected function getElements()
    {
        $name = str_replace('#', '', $this->selector);

        $id = str_replace(['[', ']'], ['\\[', '\\]'], $name);

        return collect(explode(',', $this->validElements()))->map(function ($element) use ($name, $id) {
            return "{$element}#{$id}, {$element}[name='{$name}']";
        })->all();
    }
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;
  }
756715
public function getHtml(): string
  {
    $this->attributes['name'] = $this->submitName;

    $html = $this->prefix;
    $html .= $this->getHtmlPrefixLabel();
    $html .= Html::generateTag('select', $this->attributes);

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

    // Add an empty option, if necessary.
    if ($this->emptyOption!==null)
    {
      $optionAttributes = ['value'    => $this->emptyOption,
                           'selected' => ($valueAsString===Cast::toManString($this->emptyOption, ''))];

      $html .= Html::generateElement('option', $optionAttributes, ' ');
    }

    if (is_array($this->options))
    {
      foreach ($this->options as $option)
      {
        $optionAttributes = $this->optionAttributes($option);

        // Get the (database) key of the option.
        $key         = $option[$this->keyKey];
        $keyAsString = Cast::toManString($key, '');

        // If an obfuscator is installed compute the obfuscated code of the (database) ID.
        $code = ($this->optionsObfuscator) ? $this->optionsObfuscator->encode(Cast::toOptInt($key)) : $keyAsString;

        $optionAttributes['value']    = $code;
        $optionAttributes['selected'] = ($valueAsString===$keyAsString);

        $html .= Html::generateElement('option', $optionAttributes, Cast::toOptString($option[$this->labelKey]));
      }
    }

    $html .= '</select>';
    $html .= $this->getHtmlPostfixLabel();
    $html .= $this->postfix;

    return $html;
  }
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);
    }
277652
public function getHtml()
  {
    $html = "";

    $table_classes = $this->getTableClasses();

    if($this->table_responsive)
    {
      $html.= "<div class=\"table-responsive\">\n";
    }

    $id_tag = $this->getTagId();

    $html.= "<table {$id_tag} class=\"table {$table_classes}\">\n";

    // table header
    if( isset($this->header) )
    {
        $html.= "\t<thead>\n";
        $html.= $this->header->getHtml();
        $html.= $this->fillWithEmptyCells($this->header, $this->header->getTagRow() );
        $html.= "\t</thead>\n";
    }

    // table data
    if( isset($this->rows))
    {
      $html.= "\t<tbody>\n";
      foreach($this->rows as $row)
      {
        $html.= $row->getHtml();
        $html.= $this->fillWithEmptyCells($row, $row->getTagRow() );
      }
      $html.= "\t</tbody>\n";
    }

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

    if($this->table_responsive)
    {
      $html.= "</div>\n";
    }

    return $html;
  }
1013206
public function getAsPreviewHTML()
    {
        $html = "";
        foreach ($this->getChildren() as $child) {
            $html .= $child->getAsPreviewHTML();
        }

        return $html;
    }