Loops over fields in element to determine if they have preparse fields.

@param Element $element
@param string  $eventHandle

@return array
357555
public function getPreparseFieldsContent(Element $element, string $eventHandle)
    {
        $content = [];
        $fieldLayout = $element->getFieldLayout();

        if ($fieldLayout) {
            foreach ($fieldLayout->getFields() as $field) {
                if ($field && \get_class($field) === 'aelvan\preparsefield\fields\PreparseFieldType') {
                    /** @var PreparseFieldType $field */

                    // only get field content for the right event listener
                    $isBeforeSave = ($eventHandle === 'onBeforeSave');
                    $parseBeforeSave = (bool)$field->parseBeforeSave;

                    if ($isBeforeSave === $parseBeforeSave) {
                        $fieldValue = $this->parseField($field, $element);

                        if ($fieldValue !== null) {
                            $content[$field->handle] = $fieldValue;
                        }
                    }
                }
            }
        }

        return $content;
    }
288144
public static function preRenderWebformElement($element) {
    $webform = ($element['#webform'] instanceof WebformInterface) ? $element['#webform'] : WebformEntity::load($element['#webform']);
    if (!$webform) {
      return $element;
    }

    if ($webform->access('submission_create')) {
      $values = [];

      // Set data.
      $values['data'] = $element['#default_data'];

      // Set source entity type and id.
      if (!empty($element['#entity']) && $element['#entity'] instanceof EntityInterface) {
        $values['entity_type'] = $element['#entity']->getEntityTypeId();
        $values['entity_id'] = $element['#entity']->id();
      }
      elseif (!empty($element['#entity_type']) && !empty($element['#entity_id'])) {
        $values['entity_type'] = $element['#entity_type'];
        $values['entity_id'] = $element['#entity_id'];
      }

      if (!empty($element['#override'])) {
        $new_settings = $element['#override'];
        $webform->setSettingsOverride($new_settings);
        $values['strawberryfield:override'] = $new_settings;

      }

      // Build the webform.
      $element['webform_build'] = $webform->getSubmissionForm($values);

      // Set custom form action.
      if (!empty($element['#action'])) {
        $element['webform_build']['#action'] = $element['#action'];
      }
    }
    elseif ($webform->getSetting('form_access_denied') !== WebformInterface::ACCESS_DENIED_DEFAULT) {
      // Set access denied message.
      $element['webform_access_denied'] = static::buildAccessDenied($webform);
    }
    else {
      // Add config and webform to cache contexts.
      $config = \Drupal::configFactory()->get('webform.settings');
      $renderer = \Drupal::service('renderer');
      $renderer->addCacheableDependency($element, $config);
      $renderer->addCacheableDependency($element, $webform);
    }

    return $element;
  }
639213
protected function yieldAssignmentElement(AssignmentElement $element)
    {
        foreach ($this->getOption('assignment_handlers') as $handler) {
            $iterator = $handler($element) ?: [];
            foreach ($iterator as $newElement) {
                yield $newElement;
            }
        }

        /* @var MarkupElement $markup */
        $markup = $element->getContainer();

        $arguments = [];
        foreach ($markup->getAssignmentsByName('attributes') as $attributesAssignment) {
            /* @var AssignmentElement $attributesAssignment */
            foreach ($attributesAssignment->getAttributes() as $attribute) {
                /* @var AbstractValueElement $attribute */
                $value = $attribute;
                $checked = method_exists($value, 'isChecked') && $value->isChecked();
                while (method_exists($value, 'getValue')) {
                    $value = $value->getValue();
                }
                $arguments[] = $this->formatCode($value, $checked);
            }
            $markup->removedAssignment($attributesAssignment);
        }

        $attributes = $markup->getAttributes();
        foreach ($attributes as $attribute) {
            /* @var AttributeElement $attribute */
            $arguments[] = $this->formatAttributeAsArrayItem($attribute);
        }
        $attributes->removeAll($attributes);

        foreach ($markup->getAssignments() as $assignment) {
            /* @var AssignmentElement $assignment */
            $this->throwException(
                'Unable to handle '.$assignment->getName().' assignment',
                $assignment
            );
        }

        if (count($arguments)) {
            yield $this->attributesAssignmentsFromPairs($arguments);
        }
    }
1176033
function() {
      if (this._elementPrepared) {
        console.warn('Element already prepared', this.localName);
        return;
      }
      this._elementPrepared = true;
      // storage for shadowRoots info
      this.shadowRoots = {};
      // install property observers
      this.createPropertyObserver();
      this.openPropertyObserver();
      // install boilerplate attributes
      this.copyInstanceAttributes();
      // process input attributes
      this.takeAttributes();
      // add event listeners
      this.addHostListeners();
    }
1143735
private function isElementValueNull(\DOMElement $element): bool
    {
        $namespaceUri = 'http://www.w3.org/2001/XMLSchema-instance';

        if (!$element->hasAttributeNS($namespaceUri, 'nil')) {
            return false;
        }

        return 'true' === $element->getAttributeNS($namespaceUri, 'nil') || '1' === $element->getAttributeNS($namespaceUri, 'nil');
    }
932259
function init ($container, elementSelector, eventSelectors, handler) {
      $container = $container || $(document.body)

      // Handle control clicks
      function deferred () {
        var $control = $(this)
        handler($control, getToggledContent($control))
      }

      // Prepare ARIA attributes
      var $controls = $(elementSelector)
      $controls.each(initToggledContent)

      // Handle events
      $.each(eventSelectors, function (idx, eventSelector) {
        $container.on('click.' + selectors.namespace, eventSelector, deferred)
      })

      // Any already :checked on init?
      if ($controls.is(':checked')) {
        $controls.filter(':checked').each(deferred)
      }
    }
497324
public function _doJQuery($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false) {
		$param=$this->_prep_value($param);
		$callback="";
		if ($jsCallback!="")
			$callback=", function(event){\n{$jsCallback}\n}";
			$script="$(".$this->_prep_element($element).").".$jqueryCall."(".$param.$callback.");\n";
			if ($immediatly)
				$this->jquery_code_for_compile[]=$script;
				return $script;
	}
593
protected function parseArgs(DOMElement $element)
    {
        $args = XmlUtil::getChildElements($element, 'arg');
        foreach ($args as $arg) {
            $name = XmlUtil::getRequiredAttributeValue($arg, 'name');
            $this->args[$name] = XmlUtil::getText($arg);
        }
    }
831572
public function processElement(\DOMElement $element, ContextInterface $context)
    {
        // Create a property
        $propertyContext = $this->processProperty($element, $context);

        // Process the element in case it's an anonymous thing with no children
        if (!$element->childNodes->length) {
            $this->processChild($element, $context);
        }

        return $propertyContext;
    }
1239958
public function processElement(\DOMElement $element, ContextInterface $context)
    {
        // Process default vocabulary registrations
        $context = $this->processVocab($element, $context);

        // Register vocabulary prefixes
        $context = $this->processPrefix($element, $context);

        // Create a property
        return $this->processProperty($element, $context);
    }
733019
protected function parseTables(\SimpleXMLElement $element)
    {
        /** @var \SimpleXMLElement $tableElement */
        foreach ($element as $tableElement) {
            $attributes = $tableElement->attributes();
            
            $tableName = (string) $attributes['table'];
            $tablePhpName = isset($attributes['name']) && !empty((string) $attributes['name'])
                ? (string) $attributes['name']
                : $tableName;
            
            $table = new Table($tableName);
            $table->setName($tablePhpName);
            
            $this->schema->addTable($table);
            $this->parseColumns($tableElement, $table);
            $this->parseRelations($tableElement, $table);
        }
        
        return $this;
    }
672135
protected function processPrefix(\DOMElement $element, ContextInterface $context)
    {
        if ($element->hasAttribute('prefix') && ($context instanceof RdfaLiteContext)) {
            $prefixes = preg_split('/\s+/', $element->getAttribute('prefix'));
            while (count($prefixes)) {
                $prefix = rtrim(array_shift($prefixes), ':');
                $uri = array_shift($prefixes);
                $context = $context->registerVocabulary($prefix, $uri);
            }
        }

        return $context;
    }
336186
public static function getUserByHandle($element)
    {
        $user = Craft::$app->users->getUserByUsernameOrEmail($element['username']);
        if ($user) {
            return $user;
        }

        return false;
    }
183124
public function _includeElements(&$element)
    {
        if ($element->isGlobal() && !$element->isFinal() && !$this->_globals) {
            return FALSE;
        } elseif ($element->isGlobal() && $element->isFinal() && !$this->_constants) {
            return FALSE;
        } elseif (!$this->_private && $element->isPrivate()) {
            return FALSE;
        } elseif ($this->_private) {
            return TRUE;
        } elseif ($this->_protected && ($element->isPublic() || $element->isProtected())) {
            return TRUE;
        } elseif ($this->_public && $element->isPublic()) {
            return TRUE;
        }

        return FALSE;
    }
644035
protected function getFormElements($type = 'list', $element)
    {
        $form = array();
        $template = $this->getTemplate("{$type}-block");
        $attributes = $this->getModelAttributes($this->tableInfo);

        foreach($attributes as $name)
        {
            $form[] = $this->renderElement($template, $element, $name);
        }

        return implode(PHP_EOL . PHP_EOL, $form);
    }
158289
public static function prep_element($element) {
		if (self::containsCode($element)===false) {
			$element='"'.addslashes($element).'"';
		}
		return $element;
	}
116474
function structHandlerBr( $element, $newParent )
    {
        $ret = array();
        $ret['result'] = $newParent;
        $parent = $element->parentNode;

        $next = $element->nextSibling;

        if ( $element->getAttribute( 'ignore' ) != 'true' &&
             $next &&
             $next->nodeName == 'br' )
        {
            if ( $this->XMLSchema->check( $parent, 'paragraph' ) )
            {
                if ( !$newParent )
                {
                    // create paragraph in case of the first empty paragraph
                    $newPara = $this->createAndPublishElement( 'paragraph', $ret );
                    $parent->replaceChild( $newPara, $element );
                }
                elseif ( $newParent->nodeName == 'paragraph' ||
                         $newParent->nodeName == 'line' )
                {
                    // break paragraph or line flow
                    unset( $ret );
                    $ret = array();

                    // Do not process next <br> tag
                    $next->setAttribute( 'ignore', 'true' );

                    // create paragraph in case of the last empty paragraph (not inside section)
                    $nextToNext = $next->nextSibling;
                    $tmp = $parent;
                    while( !$nextToNext && $tmp && $tmp->nodeName == 'section' )
                    {
                        $nextToNext = $tmp->nextSibling;
                        $tmp = $tmp->parentNode;
                    }
                    if ( !$nextToNext )
                    {
                        $newPara = $this->createAndPublishElement( 'paragraph', $ret );
                        $parent->replaceChild( $newPara, $element );
                    }
                }
            }
        }
        else
        {
            if ( $newParent && $newParent->nodeName == 'line' )
            {
                $ret['result'] = $newParent->parentNode;
            }
        }

        // Trim spaces used for tag indenting
        if ( $next && $next->nodeType == XML_TEXT_NODE && !trim( $next->textContent ) )
        {
            $nextToNext = $next->nextSibling;
            if ( !$nextToNext || $nextToNext->nodeName != 'br' )
            {
                $next = $parent->removeChild( $next );
            }
        }
        return $ret;
    }