$field ) { $normalized[] = array( 'label' => (string) ( $field['label'] ?? '' ), 'name' => 'kb_field_' . $index, 'type' => (string) ( $field['type'] ?? '' ), 'value' => $field['value'] ?? '', ); } $page = ctype_digit( (string) $post_id ) ? (string) get_the_title( (int) $post_id ) : ''; Capture::submission( self::key(), self::block_key( (string) $post_id, (string) $form_id ), '' !== $page ? $page : __( 'Kadence form', 'dealroot' ), $normalized ); } /** * Stores a submission of the Advanced Form block. * * @param array $form_args Form settings and fields. * @param array $fields Processed fields. * @param string $post_id Form post ID. */ public function capture_advanced( $form_args, $fields, $post_id ) { unset( $form_args ); $normalized = array(); foreach ( (array) $fields as $field ) { $normalized[] = array( 'label' => (string) ( $field['label'] ?? '' ), 'name' => (string) ( $field['name'] ?? '' ), 'type' => (string) ( $field['type'] ?? '' ), 'value' => $field['value'] ?? '', ); } Capture::submission( self::key(), (string) absint( $post_id ), (string) get_the_title( absint( $post_id ) ), $normalized ); } /** * Form key of a Form block: page and block ID, as the page shows them. * * @param string $post_id Page ID. * @param string $form_id Block ID. * @return string */ private static function block_key( $post_id, $form_id ) { return mb_substr( preg_replace( '/[^A-Za-z0-9_-]/', '', $post_id . '-' . $form_id ), 0, 64 ); } }