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;
    }
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;
    }
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 ; }
Loops over fields in element to determine if they have preparse fields.

@param Element $element
@param string  $eventHandle

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