Render the captcha

@param  ElementInterface          $element
@throws Exception\DomainException
@return string
349435
public function render(ElementInterface $element)
    {
        $captcha = $element->getCaptcha();

        if ($captcha === null || !$captcha instanceof CaptchaAdapter) {
            throw new Exception\DomainException(sprintf(
                '%s requires that the element has a "captcha" attribute of type Zend\Captcha\Image; none found',
                __METHOD__
            ));
        }

        $captcha->generate();

        $imgAttributes = array(
            'width'  => $captcha->getWidth(),
            'height' => $captcha->getHeight(),
            'alt'    => $captcha->getImgAlt(),
            'src'    => $captcha->getImgUrl() . $captcha->getId() . $captcha->getSuffix(),
        );

        if ($element->hasAttribute('id')) {
            $imgAttributes['id'] = $element->getAttribute('id') . '-image';
        }

        $closingBracket = $this->getInlineClosingBracket();
        $img = sprintf(
            '<img %s%s',
            $this->createAttributesString($imgAttributes),
            $closingBracket
        );

        $position     = $this->getCaptchaPosition();
        $separator    = $this->getSeparator();
        $captchaInput = $this->renderCaptchaInputs($element);

        $pattern = '<div style="float:left;" class="form-captcha-image">%s%s</div><div class="form-captcha-input" style="margin-left:' . $imgAttributes['width'] . 'px">%s</div>';
        if ($position == self::CAPTCHA_PREPEND) {
            return sprintf($pattern, $captchaInput, $separator, $img);
        }
        return sprintf($pattern, $img, $separator, $captchaInput);
    }
175589
protected function renderControl(ElementInterface $element, $elementString, $id, $controlWrapper = null)
    {
        $description = $this->getDescriptionHelper()->render($element);
        $label       = $this->renderLabel($element);
        $control     = $this->renderControlWrapper($id, $element, $elementString, $description, $controlWrapper);
        if ($label) {
            switch ($this->labelPosition) {
                case self::LABEL_PREPEND:
                    return $label . $control;
                case self::LABEL_APPEND:
                default:
                    return $control . $label;
            }
        }
        return $control;
    }
1311290
public function convert(ElementInterface $element)
    {
        $tag = $element->getTagName();

        $value = $element->getValue();

        if ($tag === 'i' || $tag === 'em')
        {
            $style = $this->config->getOption('italic_style');
        }
        else
        {
            $style = $this->config->getOption('bold_style');

            if (! $this->hasLinks($value))
            {
                $value = mb_convert_case($value, MB_CASE_UPPER, 'UTF-8');
            }
        }

        list($prefix, $suffix) = $this->prefixSuffix($value);

        return $prefix . $style . trim($value) . $style . $suffix;
    }
790690
protected function renderElementIcon(ElementInterface $element)
    {
        $render = '';
        $icon   = $element->getOption('icon');
        if ($icon) {
            $iconHelper = $this->getIconHelper();
            $render     = $iconHelper($icon);
        }
        return $render;
    }
1360083
public function render(ElementInterface $element, $blockWrapper = null, $inlineWrapper = null)
    {
        $html   = '';
        $inline = $element->getOption('help-inline');
        $block  = $element->getOption('help-block');
        if ($inline) {
            $html .= sprintf($inlineWrapper ?: $this->inlineWrapper, $inline);
        }
        if ($block) {
            $html .= sprintf($blockWrapper ?: $this->blockWrapper, $block);
        }
        return $html;
    }
119846
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
    {
        if ($this->getValues()) {
            $element->setValue($this->getValues());
        }

        $this->setElement($element);

        return $this->toHtml();
    }
308658
protected function renderHelper($name, ElementInterface $element)
    {
        $helper = $this->getView()->plugin($name);
        return $helper($element);
    }
857933
protected function initFormElement(ElementInterface $element)
    {
        $this->name($element->getName())->type('text');

        $this->getElement()->addAttributes($element->getAttributes());

        $type = $element->getAttribute('type');

        if (null !== $type) {
            $this->type(strtolower($type));
        }

        $this->value($element->getValue());

        return $this;
    }
97971
public function render(ElementInterface $element): string
    {
        if (! $element instanceof ErrorAwareInterface) {
            throw new InvalidClassException(
                sprintf(
                    'The given element "%s" does not implement "%s"',
                    $element->name(),
                    ErrorAwareInterface::class
                )
            );
        }

        $errors = $element->errors();
        if (count($errors) < 1) {
            return '';
        }

        $html = array_reduce(
            $errors,
            function ($html, $error): string {
                $html .= sprintf(
                    $this->options['error'],
                    $error
                );

                return $html;
            },
            ''
        );

        return sprintf(
            $this->options['wrapper'],
            $html
        );
    }
211153
public function render(Element $element)
    {
        $method = $this->getMethodNameForClass($element);

        if (!method_exists($this, $method)) {
            throw new \Exception('Error, render method "' . $method . '" was not found');
        }

        $errorHtml = $this->renderErrorMessages($element);

        $helpHtml = $this->renderHelpText($element);

        $html = $this->$method($element);

        return $html . $helpHtml . $errorHtml;
    }
831692
public function renderInput($element)
	{
		if ($element instanceof Option ||
			$element instanceof Optgroup ||
			$element instanceof Checkbox ||
			$element instanceof Radio )
		{
			return $element->render($this);
		}

		$name = $element->getName();
		$element->setAttribute('id', 'form_'.$name);

		$this->table->addCell($element->getLabel());
		$this->table->addCell($element->render($this));
		$this->table->addRow();

		return '';
	}
1024181
public function renderForm($element = 'form', $params = [])
    {
        $this->controller->requireAsset('javascript', 'backstretch');

        $form_element = $this->mapAuthenticationTypeFilePath($element . '.php');
        if (!$form_element->exists()) {
            $form_element = $this->mapAuthenticationTypeFilePath('form.php');
            if (method_exists($this->controller, 'form')) {
                call_user_func_array([$this->controller, 'form'], $params);
            }
        }
        ob_start();
        if (method_exists($this->controller, $element)) {
            call_user_func_array([$this->controller, $element], $params);
        } else {
            $this->controller->view();
        }
        extract(array_merge($params, $this->controller->getSets()));
        require $form_element->file;
        $out = ob_get_contents();
        ob_end_clean();
        echo $out;
    }
625238
public function validateUrl(ElementInterface $element)
	{
		$value = $element->getFieldValue($this->handle);

		// Make sure the value matches at least one of the allowed types.
		$matches = false;
		foreach ($this->urlTypes as $type) {
			switch ($type) {
				case 'relative':
					// Starts with a forward slash, and contains no whitespace.
					$matches = $matches | preg_match('/^\/\S*$/iu', $value);
					break;
				case 'absolute':
					// Regex by diegoperini, documented at https://mathiasbynens.be/demo/url-regex
					$matches = $matches | preg_match('/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu', $value);
					break;
				case 'mailto':
					// Begins with 'mailto:' and contains at least one @ symbol.
					$matches = $matches | preg_match('/^mailto:.*@.*/u', $value);
					break;
				case 'tel':
					// Begins with 'tel:'.
					$matches = $matches | preg_match('/^tel:.*/u', $value);
					break;
				default:
					$element->addError($this->handle, Craft::t('advanced-url-field', 'Unknown URL type in field settings.'));
					break;
			}
		}

		if (!$matches) {
			$element->addError($this->handle, Craft::t('advanced-url-field', 'URL provided does not match the allowed formats.'));
		}
	}
589515
public function convert(ElementInterface $element)
    {
        $children = array();

        foreach ($element->getChildren() as $item)
        {
            $value = str_replace("\n", ' ', $item->getValue());

            $null = $value === ' ' || empty($value);

            $null === false && array_push($children, $value);
        }

        return implode(' - ', $children) . "\n";
    }
1280124
public function getInputHtml ($value, ElementInterface $element = null): string
	{
		if ($element !== null && $element->hasEagerLoadedElements($this->handle))
			$value = $element->getEagerLoadedElements($this->handle);

		/** @noinspection PhpComposerExtensionStubsInspection */
		return new Markup(
			$this->_renderMap($value),
			'utf-8'
		);
	}
747512
public function render( ElementInterface $element )
    {
        if ( ! $element instanceof TagListElement )
        {
            throw new Exception\InvalidArgumentException( sprintf(
                '%s requires that the element is of type Grid\Tag\Form\Element\TagList',
                __METHOD__
            ) );
        }

        $rendered       = '';
        $type           = $this->getInputType();
        $name           = static::getName( $element );
        $closingBracket = $this->getInlineClosingBracket();

        $hidden = sprintf(
            '<input %s%s',
            $this->createAttributesString( array(
                'type'  => 'hidden',
                'name'  => $element->getName(),
                'value' => '',
            ) ),
            $closingBracket
        );

        foreach ( $element->getValue() as $value )
        {
            $rendered .= sprintf(
                '<input %s%s',
                $this->createAttributesString( array(
                    'type'  => $type,
                    'name'  => $name,
                    'value' => $value,
                ) ),
                $closingBracket
            );
        }

        $attributes = $element->getAttributes();

        if ( empty( $attributes['class'] ) )
        {
            $attributes['class'] = '';
        }
        else
        {
            $attributes['class'] .= ' ';
        }

        $attributes['class'] .= 'tag_list';
        $attributes['data-name'] = $name;
        unset( $attributes['type'] );
        unset( $attributes['name'] );
        unset( $attributes['value'] );

        return sprintf(
            '%s<div %s>%s</div>',
            $hidden,
            $this->createAttributesString( $attributes ),
            $rendered
        );
    }
1106989
public function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
    {
        $url = $this->escapeUrl($this->_urlBuilder->getUrl('dotdigitalgroup_email/run/catalogsync'));

        return $this->getLayout()
            ->createBlock(\Magento\Backend\Block\Widget\Button::class)
            ->setType('button')
            ->setLabel($this->buttonLabel)
            ->setOnClick("window.location.href='" . $url . "'")
            ->toHtml();
    }