Returns element javascript-friendly name

@param ElementInterface $element

@return string
777305
protected function getJavascriptNodeName(ElementInterface $element)
    {
        $class = $this->getElementClass($element);
        $parts = explode('\\', $class);

        return 'GForm' . end($parts);
    }
930415
protected function renderLabel(ElementInterface $element)
    {
        $label = $element->getLabel();
        if (null === $label) {
            $label = $element->getOption('label') ? : $element->getAttribute('label');
        }
        if ($label) {
            $element->setLabelAttributes(['class' => 'control-label']);
            return $this->getLabelHelper()->__invoke($element, $label);
        }
        return null;
    }
1099198
public function getElement($name)
    {
        $returnValue = null;



		foreach($this->elements as $element){
			if($element->getName() == $name){
				$returnValue = $element;
				break;
			}
		}
		if (is_null($returnValue)) {
			common_Logger::w('Element with name \''.$name.'\' not found');
		}


        return $returnValue;
    }
682366
public static function getDebugTag( $element ) {
		if ( !$element ) {
			return '';
		} elseif ( $element instanceof Element || $element instanceof SerializerNode ) {
			return $element->getDebugTag();
		} else {
			return get_class( $element ) . '#' . substr( md5( spl_object_hash( $element ) ), 0, 8 );
		}
	}
432325
protected function getElementGroup($elementName)
    {
        $returnValue =  '';

		foreach($this->groups as $groupName => $group){
				if(in_array($elementName, $group['elements'])){
					$returnValue = $groupName;
					break;
				}
		}

        return $returnValue;
    }
641849
function getElementName($index)
    {
        $this->_createElementsIfNotExist();
        $elementName = false;
        if (is_int($index) && isset($this->_elements[$index])) {
            $elementName = $this->_elements[$index]->getName();
            if (isset($elementName) && $elementName == '') {
                $elementName = $index;
            }
            if ($this->_appendName) {
                if (is_null($elementName)) {
                    $elementName = $this->getName();
                } else {
                    $elementName = $this->getName().'['.$elementName.']';
                }
            }

        } elseif (is_string($index)) {
            foreach (array_keys($this->_elements) as $key) {
                $elementName = $this->_elements[$key]->getName();
                if ($index == $elementName) {
                    if ($this->_appendName) {
                        $elementName = $this->getName().'['.$elementName.']';
                    }
                    break;
                } elseif ($this->_appendName && $this->getName().'['.$elementName.']' == $index) {
                    break;
                }
            }
        }
        return $elementName;
    }
75982
public function getTableAttributeHtml ($value, ElementInterface $element): string
	{
		return $this->normalizeValue($value, $element)->address;
	}
509959
protected function renderError(ElementInterface $element)
    {
        $messages = $element->getMessages();

        if (empty($messages)) {
            return null;
        }

        $errorPlugin = $this->getView()->plugin('sxb_form_errors');

        return $errorPlugin($element);
    }
97685
public function get($name)
    {
        $found = null;
        /** @var ElementInterface $element */
        foreach ($this->elements as $element) {
            if ($element->getName() == $name) {
                $found = $element;
            }
        }
        return $found;
    }
254778
public function render(ElementInterface $element)
    {
        // Set class
        $class = $element->getAttribute('class');
        if ($class) {
            $class .= ' ';
        }
        $element->setAttribute('class', $class . 'form-control');

        // Set placeholder
        $placeholder = $element->getAttribute('placeholder');
        if (!$placeholder) {
            $element->setAttribute('placeholder', $element->getLabel());
        }

        return parent::render($element);
    }
356274
public function add(ElementInterface $element)
    {
        if (null === $element->getName()) {
            $this->data[] = $element;
            return $this;
        }
        $this->data[$element->getName()] = $element;
        return $this;
    }
193146
protected function getElementName(Property $property)
	{
		/* @var $annotations ElementNameAnnotation[] */
		$annotations = $property->getAnnotationsFromPropertyOrClass('@element-name');

		if ( $annotations && ($annotations[0] instanceof ElementNameAnnotation) ) {
			return $annotations[0]->name;
		}

		return (string)$property;
	}
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.'));
		}
	}
175211
public function render(ElementInterface $element): string
    {
        if (! $element instanceof Element\CollectionElement) {
            throw new InvalidClassException(
                sprintf(
                    'The given element "%s" has to implement "%s"',
                    $element->name(),
                    Element\CollectionElement::class
                )
            );
        }

        $row = $this->factory->create(FormRow::class);

        $html = array_reduce(
            $element->elements(),
            function ($html, ElementInterface $next) use ($element, $row) {
                // adding the CollectionElement name to the Element name and ID as prefix.
                $next->withAttribute('id', $element->name().'_'.$next->id());
                $next->withAttribute('name', $element->name().'['.$next->name().']');

                $html .= $row->render($next);

                return $html;
            },
            ''
        );

        $errors = $this->factory->create(Errors::class)
            ->render($element);
        $class = $errors !== ''
            ? 'form-table--has-errors'
            : '';

        return sprintf('%1$s<table class="form-table %2$s">%3$s</table>', $errors, $class, $html);
    }
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);
    }
1103466
protected function getElementTemplate($element)
  {
    $element = strtolower($element);
    if (!array_key_exists($element, $this->elementTemplates)) {
      throw new \Exception(sprintf('Element %s non reconnu.', $element));
      return '';
    }

    if (!is_null($this->elementTemplates[$element])) {
      return $this->elementTemplates[$element];
    }

    $content = static::getAssetContent($element);
    $content = str_replace('%class%', implode(' ', $this->elementClasses[$element]), $content);
    $content = str_replace('%querystring%', $this->getQueryString(), $content);
    $content = str_replace('%argumentname%', $this->argumentName, $content);
    $this->elementTemplates[$element] = $content;
    return $content;
  }
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);
    }