Gets an element from the form if it exists

@param string $elementname
@return HTML_QuickForm_input|MoodleQuickForm_group
7312
public function get_element($elementname) {
        if ($this->_form->elementExists($elementname)) {
            return $this->_form->getElement($elementname);
        } else {
            return false;
        }
    }
309666
public function getFormPageByFormName($formName)
    {
        if ($formPage = $this->getFormPages()->filter(
            function($formPage) use($formName) {
                /** @var FormDocument $form */
                if ($form = $formPage->getForm()) {
                    if ($form->getName() == $formName) {
                        return true;
                    }
                }

                return false;
            }
        )->first()) {
            return $formPage;
        }

        return null;
    }
1169274
function get($element) {
        $node = $this->findNode($element, $this->root);

        assert($node != null);

        return $node->value();
    }
397916
public static function getChildNodesOfName(\DOMElement $element, $elementName) {
    $result = [];
    foreach ($element->childNodes as $child) {
      if ($child->nodeName == $elementName) {
        $result[] = $child;
      }
    }
    return $result;
  }
437591
public function getElementLabel($elementName)
	{
		if($label = $this->getSetting($elementName, 'label'))
		{
			return (string)$label;
		}
		return ucwords(str_replace('_', ' ', $elementName));
	}
331414
public static function getElementsByTagName($node, $tagName)
    {
        $ret = array();
        $nodes = $node->getElementsByTagName($tagName);
        foreach ($nodes as $node) {
            if ($node instanceof DOMElement) {
                array_push($ret, $node);
            }
        }
        return $ret;
    }
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;
    }
281133
public static function getInputByNameSelector($formName, $fieldName)
    {
        $formSelector = static::getFormByNameSelector($formName);
        $fieldName = trim($fieldName);

        if (empty($formSelector) || empty($fieldName)) {
            return '';
        }

        return sprintf('%s input[name="%s"]', $formSelector, $fieldName);
    }
120366
public function resolveElement(Element $element)
    {
        $elementtype = $this->elementService->findElementtype($element);

        return $this->resolveElementtype($elementtype);
    }
1322546
function _getElNamesRecursive($element) {
        if (is_string($element)) {
            if (!$this->elementExists($element)) {
                return array();
            }
            $element = $this->getElement($element);
        }

        if (is_a($element, 'HTML_QuickForm_group')) {
            $elsInGroup = $element->getElements();
            $elNames = array();
            foreach ($elsInGroup as $elInGroup){
                if (is_a($elInGroup, 'HTML_QuickForm_group')) {
                    // Groups nested in groups: append the group name to the element and then change it back.
                    // We will be appending group name again in MoodleQuickForm_group::export_for_template().
                    $oldname = $elInGroup->getName();
                    if ($element->_appendName) {
                        $elInGroup->setName($element->getName() . '[' . $oldname . ']');
                    }
                    $elNames = array_merge($elNames, $this->_getElNamesRecursive($elInGroup));
                    $elInGroup->setName($oldname);
                } else {
                    $elNames[] = $element->getElementName($elInGroup->getName());
                }
            }

        } else if (is_a($element, 'HTML_QuickForm_header')) {
            return array();

        } else if (is_a($element, 'HTML_QuickForm_hidden')) {
            return array();

        } else if (method_exists($element, 'getPrivateName') &&
                !($element instanceof HTML_QuickForm_advcheckbox)) {
            // The advcheckbox element implements a method called getPrivateName,
            // but in a way that is not compatible with the generic API, so we
            // have to explicitly exclude it.
            return array($element->getPrivateName());

        } else {
            $elNames = array($element->getName());
        }

        return $elNames;
    }
1081563
public function isElementHidden($elementName)
	{
		if( $this->settingExists($elementName) ? $settings = $this->getSetting($elementName) : false)
		{
			if(isset($settings['hidden']) && $settings['hidden'] == true)
			{
				return true;
			}
		}
		return false;
	}
775407
public function MoodleQuickForm_autocomplete($elementName=null, $elementLabel=null, $options=null, $attributes=null) {
        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
        self::__construct($elementName, $elementLabel, $options, $attributes);
    }
1027214
public function getConfigForElement(array $config, $elementName, $beanName, $customKeyName = 'beans')
    {
        if(!isset($config[$elementName])) {
            return false;
        }

        return $config[$elementName];
    }
424007
public function getForm()
    {
        $elementString = '';

        if (isset($this->attributes[self::$formHolder[self::$formName]])) {
            $elementString .= $this->attributes[self::$formHolder[self::$formName]][self::$formName];
        }

        $elementString .= $this->getHtmlElements();

        $close = null;
        $close = self::$formHolder[self::$formName].'_close';

        if (isset($this->attributes[$close])) {
            $elementString .= $this->attributes[$close];
        }

        return $this->element[self::$formHolder[self::$formName]] = $elementString;
    }
105286
public function getElementByTagName($tagName)
    {
        if (null === $this->treeRoot){
            return array();
        }
        $children = $this->treeRoot->getChildren();

        return $this->getElementByTagInChildren($children, $tagName);
    }
257994
protected function getElementAttribute(DomElement $element, $attributeName)
    {
        // First try to return for link
        if ($element->localName === 'link') {
            return $element->getAttribute($attributeName);
        }

        // Second return for embed
        return $element->getAttribute(EmbedLinking::TEMP_PREFIX . $attributeName);
    }
1286779
public function getElement($indexOrName)
    {
        if (\is_string($indexOrName)) {
            foreach ($this as $element) {
                /** @var ElementInformationInterface $element */
                if ($indexOrName === $element->getName()) {
                    return $element;
                }
            }
        } elseif (!\is_numeric($indexOrName)) {
            throw new DcGeneralInvalidArgumentException('Invalid value for element name given.');
        }

        if (!isset($this->elements[$indexOrName])) {
            throw new DcGeneralInvalidArgumentException('Value out of bounds: ' . $indexOrName . '.');
        }

        return $this->elements[$indexOrName];
    }