settingsDTO->getPixels() ) < 1 ) { return; } $this->setupEventListeners(); } public function setupEventListeners() { add_action( 'forminator_form_after_save_entry', array( $this, 'contactForm' ), 10, 1 ); } public function contactForm( $formId ) { $formSettings = $this->settingsDTO->getForm( $formId, $this->pluginName ); // Send only matched fields $eventDto = new EventDTO( EventDTO::EVENT_LEAD ); $contentDto = new ContentDTO(); $post = \Forminator_Core::sanitize_array( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Verified by Forminator itself foreach ( $formSettings->getMatches() as $match ) { $val = $post[ $match->getFormField() ]; $this->assignMatchedValue( $val, $match, $eventDto, $contentDto ); } $this->sendEvent( $eventDto ); } public function getForms() { $forms = array(); foreach ( \Forminator_API::get_forms() as $form ) { $formId = $form->id; $fields = array(); foreach ( \Forminator_API::get_form_fields( $formId ) as $field ) { $fields[] = array( 'name' => $field->slug, 'label' => $field->field_label, 'type' => $field->type, ); } $forms[] = array( 'id' => $formId, 'title' => $form->name, 'plugin' => $this->pluginName, 'fields' => $fields, ); } return $forms; } } }