Utility form helper that renders a label (if it exists), an element and errors

@param  ElementInterface $element
@param  string           $groupWrapper
@param  string           $controlWrapper
@return string
182427
public function render(ElementInterface $element, $groupWrapper = null, $controlWrapper = null)
    {
        $renderer = $this->getElementHelper()->getView();
        if (method_exists($renderer, 'plugin') && $element instanceof RadioElement) {
            $renderer->plugin('form_radio')->setLabelAttributes([
                'class' => 'radio',
            ]);
        }

        $elementString = $this->getElementHelper()->render($element);
        if ($this->renderErrors) {
            $elementString .= $this->getElementErrorsHelper()->render($element);
        }
        if ($element->getAttribute('type') === 'hidden') {
            return $elementString;
        }

        return $this->renderGroup($element, $elementString, $groupWrapper, $controlWrapper);
    }
450652
public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null)
    {
        $value = General::sanitize(isset($data['value']) ? $data['value'] : null);
        $label = Widget::Label($this->get('label'));

        if ($this->get('required') !== 'yes') {
            $label->appendChild(new XMLElement('i', __('Optional')));
        }

        $label->appendChild(Widget::Input('fields'.$fieldnamePrefix.'['.$this->get('element_name').']'.$fieldnamePostfix, (strlen($value) != 0 ? $value : null)));

        if ($flagWithError != null) {
            $wrapper->appendChild(Widget::Error($label, $flagWithError));
        } else {
            $wrapper->appendChild($label);
        }
    }
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
        ];
    }
739702
protected function renderGroupWrapper(ElementInterface $element, $id, $control, $wrapper = null)
    {
        if (!$wrapper) {
            $wrapper = $this->groupWrapper;
        }
        $addErrorClass = $element->getMessages() ? ' has-error' : '';
        return sprintf($wrapper, $addErrorClass, $id, $control);
    }
1199180
protected function wrapInControlGroup()
    {
        // Add generic stuff
        $this->addGroupClass('list-form-group');

        // Use the controller description for blockhelp
        if (!$this->hasHelp()) {
            $this->blockhelp($this->controller->description());
        }

        // Show no results if there is no parent specified
        if (empty($this->parent_item)) {
            $this->addGroupClass('note');

            return $this->group->wrapField(Former::note($this->label_text, trans('decoy::form.listing.pending_save', ['model' => $this->label_text, 'description' => $this->controller->description()])));
        }

        // Add create button if we have permission and if there is a parent item
        if (app('decoy.user')->can('create', $this->controller)) {
            $this->group->setLabel(
                '<a href="'.$this->getIndexURL().'">'
                .$this->label_text
                .'</a>'
                .$this->makeCreateBtn()
            );
        }

        // Return the wrapped field
        return $this->group->wrapField($this);
    }
1215805
public function renderRow(ElementInterface $element)
    {
        /* @var $rowPlugin \SxBootstrap\View\Helper\Bootstrap\Form\ControlGroup */
        $rowPlugin   = $this->getView()->plugin('sxb_form_control_group');
        $rowPlugin   = $rowPlugin();
        $errors      = $this->renderError($element);
        $label       = $this->renderLabel($element);
        $description = $this->renderDescription($element);
        $controls    = $this->renderControls($element, null !== $errors ? $errors : $description);

        if (null !== $errors) {
            $rowPlugin->error();
        }

        $rowPlugin->addContents(array(
            $label,
            $controls,
        ));

        return $rowPlugin;
    }
596675
protected function parseControlWord(Token\Control\Word $token, Element\Group $group) 
	{
		// if a class exists for the control word
		$filename  = ucfirst($token->getWord());
		$classname = "Jstewmc\\Rtf\\Element\\Control\\Word\\$filename"; 
		if (class_exists($classname)) {
			// instantiate the control word element and break
			$word = new $classname();
		} else {
			// otherwise, instantiate a generic control word
			$word = new Element\Control\Word\Word();
			$word->setWord($token->getWord());
		}
		
		// set the element's parameter
		$word->setParameter($token->getParameter());
		$word->setIsSpaceDelimited($token->getIsSpaceDelimited());
		
		// append the element
		$word->setParent($group);
		$group->appendChild($word);
				
		return;	
	}
368267
private function renderElement(Element $element) : string
    {
        $label = $element->getLabel();

        if ($label->isEmpty()) {
            return $element->render();
        }

        return $label->render() . $element->render();
    }
1293226
public function openGroup($name, $label = null, $options = [])
    {
        $options = $this->appendClassToOptions('form-group', $options);
        // Append the name of the group to the groupStack.
        $this->groupStack[] = $name;
        if ($this->hasErrors($name)) {
            // If the form element with the given name has any errors,
            // apply the 'has-error' class to the group.
            $options = $this->appendClassToOptions('has-error', $options);
        }
        // If a label is given, we set it up here. Otherwise, we will just
        // set it to an empty string.
        $label = $label ? $this->label($name, $label, ['class' => 'control-label']) : '';

        return '<div' . $this->html->attributes($options) . '>' . $label;
    }
519185
@Override
    public void processElement(Wrapper<Element> elementWrapper) {
        Element element = elementWrapper.getContent();
        element.setAttributes(getSortedAttributes(element));
    }
887146
protected function appendWrapper(\DOMElement $element, \DOMDocument $dom)
    {
        $wrapper = $dom->createElement('div');
        $wrapper->setAttribute('class', 'cms-slide-wrapper');

        $element->appendChild($wrapper);

        return $wrapper;
    }
326107
public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = null, $entry_id = null)
    {
        $value = $data['value'];

        if ($encode === true) {
            $value = General::sanitize($value);
        } else {
            if (!General::validateXML($data['value'], $errors, false, new XsltProcess)) {
                $value = html_entity_decode($data['value'], ENT_QUOTES, 'UTF-8');
                $value = $this->__replaceAmpersands($value);

                if (!General::validateXML($value, $errors, false, new XsltProcess)) {
                    $value = General::sanitize($data['value']);
                }
            }
        }

        $wrapper->appendChild(
            new XMLElement($this->get('element_name'), $value, array('handle' => $data['handle']))
        );
    }
988813
public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null)
    {
        $states = $this->getToggleStates();
        $value = isset($data['value']) ? $data['value'] : null;

        if (!is_array($value)) {
            $value = array($value);
        }

        $options = array();
        if ($this->get('required') !== 'yes') {
            $options[] = array(null, false, null);
        }

        foreach ($states as $handle => $v) {
            $options[] = array(General::sanitize($v), in_array($v, $value), General::sanitize($v));
        }

        $fieldname = 'fields'.$fieldnamePrefix.'['.$this->get('element_name').']'.$fieldnamePostfix;

        if ($this->get('allow_multiple_selection') === 'yes') {
            $fieldname .= '[]';
        }

        $label = Widget::Label($this->get('label'));

        if ($this->get('required') !== 'yes') {
            $label->appendChild(new XMLElement('i', __('Optional')));
        }

        $label->appendChild(Widget::Select($fieldname, $options, ($this->get('allow_multiple_selection') === 'yes' ? array('multiple' => 'multiple', 'size' => count($options)) : null)));

        if ($flagWithError != null) {
            $wrapper->appendChild(Widget::Error($label, $flagWithError));
        } else {
            $wrapper->appendChild($label);
        }
    }
1113160
public function renderLabel(Nette\Forms\IControl $control)
	{
		/** @noinspection PhpUndefinedMethodInspection */
		$controlLabel = $control->getLabel();
		if ($controlLabel instanceof Html && $controlLabel->getName() == 'label') {
			// the control has already provided us with the element, no need to create our own
			$controlLabel = $this->configElem(Cnf::label, $controlLabel);
			// just configure it to suit our needs

			$labelHtml = $controlLabel;
		} elseif ($controlLabel === NULL) {
			return Html::el();
		} else {
			// the control doesn't give us <label>, se we'll create our own
			$labelHtml = $this->getElem(Cnf::label);
			if ($controlLabel) {
				$labelHtml->setHtml($controlLabel);
			}
		}

		return $labelHtml;
	}
807481
public function RenderLabel () {
		if ($this->renderMode == \MvcCore\Ext\Forms\IForm::FIELD_RENDER_MODE_NO_LABEL) 
			return '';
		$attrsStr = $this->renderAttrsWithFieldVars(
			['multiple'], $this->groupLabelAttrs, $this->groupLabelCssClasses, FALSE
		);
		$viewClass = $this->form->GetViewClass();
		/** @var $templates \stdClass */
		$templates = & static::$templates;
		return $viewClass::Format($templates->label, [
			'id'		=> $this->id,
			'label'		=> $this->label,
			'attrs'		=> $attrsStr ? " $attrsStr" : '',
		]);
	}
1344655
protected function getFormGroupWithLabel($name, $value, $element)
    {
        $options = $this->getFormGroupOptions($name);

        return $this->toHtmlString('<div' . $this->html->attributes($options) . '>' . $this->label($name, $value) . $element . '</div>');
    }
917676
public function getFormGroup($name = null, $label = null, $wrapperElement)
    {
        if (is_null($label)) {
            return $this->getFormGroupWithoutLabel($name, $wrapperElement);
        }
        return $this->getFormGroupWithLabel($name, $label, $wrapperElement);
    }