$value ) { $name = (string) $name; $definition = $definitions[ $name ] ?? null; $type = is_object( $definition ) ? (string) ( $definition->widgetType ?? '' ) : ''; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase -- MetForm's property. $fields[] = array( 'label' => is_object( $definition ) && ! empty( $definition->mf_input_label ) ? (string) $definition->mf_input_label : $name, 'name' => $name, 'type' => $name === $email_field ? 'email' : str_replace( 'mf-', '', $type ), 'value' => $value, ); } Capture::submission( self::key(), (string) absint( $form_id ), (string) get_the_title( absint( $form_id ) ), $fields ); } /** * Field definitions of a form, by field name. * * @param int $form_id Form ID. * @return array */ private static function definitions( $form_id ) { $class = '\\MetForm\\Core\\Entries\\Action'; if ( ! class_exists( $class ) || ! method_exists( $class, 'instance' ) ) { return array(); } try { return (array) $class::instance()->get_fields( $form_id ); } catch ( \Throwable $e ) { return array(); } } }