: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if ( ! empty( $args['disabled_desc'] ) ) {
$output .= '<p class="disabled-desc">' . wp_kses_post( $args['disabled_desc'] ) . '</p>';
* Settings image uploads field callback.
* @param array $args Arguments.
function wpforms_settings_image_callback( array $args ): string {
$default = isset( $args['default'] ) ? esc_html( $args['default'] ) : '';
$value = wpforms_setting( $args['id'], $default );
$id = wpforms_sanitize_key( $args['id'] );
if ( ! empty( $value ) ) {
$output .= '<img src="' . esc_url_raw( $value ) . '">';
$output .= '<input type="text" id="wpforms-setting-' . $id . '" name="' . $id . '" value="' . esc_url_raw( $value ) . '">';
// Show the remove button if specified.
if ( isset( $args['show_remove'] ) && $args['show_remove'] ) {
$output .= '<button class="wpforms-btn wpforms-btn-md wpforms-setting-remove-image">' . esc_html__( 'Remove Image', 'wpforms-lite' ) . '</button>';
$output .= '<button class="wpforms-btn wpforms-btn-md wpforms-btn-light-grey wpforms-setting-upload-image">' . esc_html__( 'Upload Image', 'wpforms-lite' ) . '</button>';
if ( ! empty( $args['desc'] ) ) {
$output .= '<p class="desc">' . wp_kses_post( $args['desc'] ) . '</p>';
* Settings color picker field callback.
* @param array $args Arguments.
function wpforms_settings_color_callback( array $args ): string {
$default = isset( $args['default'] ) ? esc_html( $args['default'] ) : '';
$value = wpforms_setting( $args['id'], $default );
$id = wpforms_sanitize_key( $args['id'] );
$data = isset( $args['data'] ) ? (array) $args['data'] : [];
foreach ( $data as $name => $val ) {
$data[ $name ] = 'data-' . sanitize_html_class( $name ) . '="' . esc_attr( $val ) . '"';
$data = implode( ' ', $data );
$output = '<input type="text" id="wpforms-setting-' . $id . '" class="wpforms-color-picker" name="' . $id . '" value="' . esc_attr( $value ) . '" ' . $data . '>';
if ( ! empty( $args['desc'] ) ) {
$output .= '<p class="desc">' . wp_kses_post( $args['desc'] ) . '</p>';
* Color scheme endpoint fieldset callback.
* This function will output a fieldset with color picker inputs.
* @param array $args Field arguments.
function wpforms_settings_color_scheme_callback( array $args ): string {
$id = wpforms_sanitize_key( $args['id'] );
$value = wpforms_setting( $args['id'], [] );
foreach ( $args['colors'] as $color => $attrs ) {
$data = isset( $attrs['data'] ) ? (array) $attrs['data'] : [];
$default_value = isset( $data['fallback-color'] ) ? wpforms_sanitize_hex_color( $data['fallback-color'] ) : '';
$field_id = "{$id}-{$color}";
$field_value = isset( $value[ $color ] ) ? wpforms_sanitize_hex_color( $value[ $color ] ) : $default_value;
$input_attributes = wpforms_html_attributes(
"wpforms-setting-{$field_id}",
[ 'wpforms-color-picker' ],
'name' => "{$id}[{$color}]",
'value' => esc_attr( $field_value ),
$output .= "<input {$input_attributes}>";
$output .= '<label for="wpforms-setting-' . $field_id . '">';
$output .= esc_html( $attrs['name'] );
if ( ! empty( $args['desc'] ) ) {
$output .= '<p class="desc">' . wp_kses_post( $args['desc'] ) . '</p>';
* Settings providers field callback - this is for the Integrations tab.
* @param array $args Arguments.
* @noinspection PhpUnusedParameterInspection
function wpforms_settings_providers_callback( array $args ): string { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
$active = wpforms_get_providers_available();
$providers = wpforms_get_providers_options();
$output = '<div id="wpforms-settings-providers">';
* Output settings providers.
* @param array $active Active providers.
* @param array $providers Providers options.
do_action( 'wpforms_settings_providers', $active, $providers );
$output .= ob_get_clean();
* Webhooks' endpoint field callback.
* @param array $args Field arguments.
function wpforms_settings_webhook_endpoint_callback( array $args ): string {
if ( ! empty( $args['url'] ) ) {
$output = '<div class="wpforms-stripe-webhook-endpoint-url">';
$output .= '<input type="text" disabled id="wpforms-stripe-webhook-endpoint-url" value="' . esc_url_raw( $args['url'] ) . '" />';
$output .= '<a class="button button-secondary wpforms-copy-to-clipboard" data-clipboard-target="#wpforms-stripe-webhook-endpoint-url" href="" ><span class="dashicons dashicons-admin-page"></span></a>';
if ( ! empty( $args['desc'] ) ) {
$output .= '<p class="desc">' . wp_kses_post( $args['desc'] ) . '</p>';
* Settings field columns callback.
* @param array $args Arguments passed by the setting.
function wpforms_settings_columns_callback( array $args ): string { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
if ( empty( $args['columns'] ) || ! is_array( $args['columns'] ) ) {
$output = '<div class="wpforms-setting-columns">';
foreach ( $args['columns'] as $column ) {
// Define default callback for this field type.
$callback = ! empty( $column['type'] ) ? 'wpforms_settings_' . $column['type'] . '_callback' : '';
// Allow custom callback to be provided via arg.
if ( ! empty( $column['callback'] ) ) {
$callback = $column['callback'];
$output .= '<div class="wpforms-setting-column">';
if ( ! empty( $column['name'] ) ) {
$output .= '<label><b>' . wp_kses_post( $column['name'] ) . '</b></label>';
if ( function_exists( $callback ) ) {
$output .= $callback( $column );