Sets value for element

@param ElementInterface $element
359694
protected function setDefaultElementValue(ElementInterface $element)
    {
        $propertyPath = $element->getPropertyPath();
        
        if ($propertyPath instanceof PropertyPathInterface) {
            if ($this->propertyAccessor->isReadable($this->data, $propertyPath)) {
                $value = $this->propertyAccessor->getValue($this->data, $propertyPath);
                if ($this->isEmptyValue($value)) {
                    $value = $element->getDefaultValue();
                }
                
                if ($element->hasTransformer() && is_object($value)) {
                    $transformer = $element->getTransformer();
                    $value       = $transformer->transform($value);
                }
                
                $element->setValue($value);
            }
        }
    }
402459
public function render(ElementInterface $element)
    {
        $labelHelper = $this->getLabelHelper();
        $elementHelper = $this->getElementHelper();
        $elementErrorsHelper = $this->getElementErrorsHelper();
        $type = $element->getAttribute('type');

        if($type == 'button' || $type == 'submit') {
            $label = $this->getElementLabel($element);
            $element->setValue($label);
        }

        if ($this->renderErrors) {
            $elementErrors = $elementErrorsHelper->render($element, ['class' => 'form-errors col-xs-6 col-md-7 col-md-offset-5 col-lg-8 col-lg-offset-4']);
        }


        $elementString = $elementHelper->render($element);
        $controlElementWrapperClass = 'col-xs-7 col-md-8 col-lg-9';

        if($element instanceof \Zend\Form\Element\DateSelect) {
            $controlElementWrapperClass .= ' form-inline';
        }

        if ($type !== 'hidden') {

            if ($type === 'multi_checkbox' || $type === 'radio' || $element instanceof \Zend\Form\Element\MonthSelect) {

                $element->setLabelAttributes(['class' => 'col-lg-3 col-xs-5 col-md-4 control-label']);
                $markup = $labelHelper($element) . '<div class="' . $controlElementWrapperClass . '">
                    <div class="btn-group" data-toggle="buttons">' . $elementString . '</div></div>';

            } elseif($type == 'button' || $type == 'submit') {
                $markup = '<div class="' . $controlElementWrapperClass . ' col-md-offset-4 col-lg-offset-3">' . $elementString . '</div>';
            } else {
                switch ($this->labelPosition) {
                    case self::LABEL_APPEND:
                        $element->setLabelAttributes(['class' => 'col-lg-3 col-xs-5 col-md-4 control-label']);
                        $markup = '<div class="' . $controlElementWrapperClass . '">' . $elementString . '</div>' . $labelHelper($element);
                        break;
                    case self::LABEL_PREPEND:
                    default:
                        $element->setLabelAttributes(['class' => 'col-lg-3 col-xs-5 col-md-4 control-label']);
                        $markup = $labelHelper($element) . '<div class="' . $controlElementWrapperClass . '">' . $elementString . '</div>';
                        break;
                }
            }

            $rowClass = 'form-group col-lg-12 col-md-12 col-xs-12';
            if ($this->renderErrors && !empty($elementErrors)) {
                $markup .= $elementErrors;
                $rowClass .= ' has-error';
            }
            $markup = '<div class="row"><div class="' . $rowClass . '">' . $markup . '</div></div>';
        } else {
            if ($this->renderErrors) {
                $markup = $elementString . $elementErrors;
            } else {
                $markup = $elementString;
            }
        }
        return $markup;
    }
478111
protected function addElementRules(ElementInterface $element, AttributeCollection $collection)
    {
        if ($element->hasOption('rules') && count($element->getOption('rules'))) {
            $rules = $this->formatter->formatRules($element->getOption('rules'));
            $collection->add(new Attribute('aoRules', $rules, Attribute::TYPE_ARRAY));
        }
    }
855187
public function setElement($document, $element = null)
    {
        if (empty($document)) {
            // Make sure we always have an element to query against which should not return any returns.
            $document = new DOMDocument();
            $document->loadXML('<dummy/>');
        }
        $this->document = $document;

        if (empty($element)) {
            $element = $this->document->documentElement;
        }
        $this->element = $element;
    }
1343657
public function render(ElementInterface $element)
    {
        if (!$element instanceof SelectElement) {
            throw new Exception\InvalidArgumentException(sprintf(
                '%s requires that the element is of type Zend\Form\Element\Select',
                __METHOD__
            ));
        }

        $name   = $element->getName();
        if (empty($name) && $name !== 0) {
            throw new Exception\DomainException(sprintf(
                '%s requires that the element has an assigned name; none discovered',
                __METHOD__
            ));
        }

        $options = $element->getValueOptions();

        if (($emptyOption = $element->getEmptyOption()) !== null) {
            $options = array('' => $emptyOption) + $options;
        }

        $attributes = $element->getAttributes();
        $value      = $this->validateMultiValue($element->getValue(), $attributes);

        $attributes['name'] = $name;
        if (array_key_exists('multiple', $attributes) && $attributes['multiple']) {
            $attributes['name'] .= '[]';
        }
        $this->validTagAttributes = $this->validSelectAttributes;

        $figlet =  sprintf(
            '<div %s>
				<button class="btn btn-primary" type="button">' . $element->getLabel() . '</button>
				<button data-toggle="dropdown" class="btn btn-primary dropdown-toggle" type="button"><span class="caret"></span></button>
				<ul class="dropdown-menu">
        			%s
        		</ul>
			</div>',
			$this->createAttributesString($attributes),
            $this->renderOptions($options, $value)
        );

        $separator = $this->getSeparator();

        $captchaInput = $this->renderInputs($element);
        
        $pattern = '%s%s%s';
        return sprintf($pattern, $figlet, $separator, $captchaInput);
    }
778876
public function setProperty(NodeInterface $node, \DOMElement $element) : void
    {
        if ($node instanceof ItemInterface) {
            $author = $node->newAuthor();
            $author->setName($element->nodeValue);
            $node->setAuthor($author);
        }
    }
1234197
function setElementTemplate($html, $element = null)
    {
        if (is_null($element)) {
            $this->_elementTemplate = $html;
        } else {
            $this->_templates[$element] = $html;
        }
    }
769578
protected void setInputElementValue(Node element, FormInput input) {

		LOGGER.debug("INPUTFIELD: {} ({})", input.getIdentification(), input.getType());
		if (element == null || input.getInputValues().isEmpty()) {
			return;
		}
		try {

			switch (input.getType()) {
				case TEXT:
				case TEXTAREA:
				case PASSWORD:
					handleText(input);
					break;
				case HIDDEN:
					handleHidden(input);
					break;
				case CHECKBOX:
					handleCheckBoxes(input);
					break;
				case RADIO:
					handleRadioSwitches(input);
					break;
				case SELECT:
					handleSelectBoxes(input);
			}

		} catch (ElementNotVisibleException e) {
			LOGGER.warn("Element not visible, input not completed.");
		} catch (BrowserConnectionException e) {
			throw e;
		} catch (RuntimeException e) {
			LOGGER.error("Could not input element values", e);
		}
	}
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;
    }
1274145
public function render(ElementInterface $element)
    {
        /* @var $element DisableElementsCapableFormSettings
         * @var $renderer   \Zend\View\Renderer\PhpRenderer
         * @var $headscript \Zend\View\Helper\HeadScript
         * @var $basepath   \Zend\View\Helper\BasePath */
        $renderer   = $this->getView();
        $headscript = $renderer->plugin('headscript');
        $basepath   = $renderer->plugin('basepath');

        $headscript->appendFile($basepath('modules/Settings/js/forms.decfs.js'));

        return '<ul class="disable-elements-list" id="' . $element->getAttribute('id') . '-list"' . '>'
               . $this->renderCheckboxes($element->getCheckboxes())
               . '</ul>';
    }
1305149
public function set($key, $value)
    {
        /**
         * @var UniqueIdentity $value
         */
        $this->elements->set($value->uId()->id(), $value);
    }
711866
protected function setAttributes(SimpleXMLElement $element)
    {
        $element->addAttribute('GUID', $this->nb_data_object->grantHash(true));
        $this->putAttributesFromList($element, array(
            'nb_site_target_key' => 'key',
            'nb_site_target_order' => 'order',
            'nb_site_target_begin_date' => 'beginDate',
            'nb_site_target_plugin_name' => 'plugin',
            'nb_site_target_php_trace' => 'trace',
            'nb_site_target_use_commerce' => 'useCommerce'
        ), false);
    }
55574
public function convert(ElementInterface $element)
    {
        $lines = explode("\n", $element->getValue());

        foreach ($lines as $key => $line)
        {
            $lines[$key] = trim($lines[$key]);
        }

        $lines = array_filter($lines);

        return "\n" . implode("\n", (array) $lines);
    }
289199
protected function mapElementToModelData(ElementInterface $child)
    {
        $this->setModelValueFromElement($child);
        
        $children = $child->getChildren();
        if ($children->count()) {
            $this->mapElementCollectionToModelData($children);
        }
    }
1104727
public function add(NodeInterface $node)
	{
		$max = $this->getMax();
		$node->setLeftValue($max + 1);
		$node->setRightValue($max + 2);
		$node->setLevel(0);
	}
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;
    }
545923
public function set($index, $element)
    {
        if (null === $index) {
            $this->collections[] = $element;
        } else {
            $this->collections[$index] = $element;
        }

        return $this;
    }