Edit File by line
/home/zeestwma/ceyloniy.../wp-conte.../plugins/wpforms-.../includes/function...
File: form-fields.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Helper functions to work with form fields, generic and specific to certain field types.
[2] Fix | Delete
*
[3] Fix | Delete
* @since 1.8.0
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Determine if we should show the "Show Values" toggle for checkbox, radio, or
[8] Fix | Delete
* select fields in form builder. Legacy.
[9] Fix | Delete
*
[10] Fix | Delete
* @since 1.5.0
[11] Fix | Delete
*
[12] Fix | Delete
* @return bool
[13] Fix | Delete
*/
[14] Fix | Delete
function wpforms_show_fields_options_setting(): bool {
[15] Fix | Delete
[16] Fix | Delete
/**
[17] Fix | Delete
* Filter to show or hide the "Show Values" toggle for checkbox, radio, or select fields in form builder.
[18] Fix | Delete
*
[19] Fix | Delete
* @since 1.5.0
[20] Fix | Delete
*
[21] Fix | Delete
* @param bool $show Show or hide the "Show Values" toggle.
[22] Fix | Delete
*/
[23] Fix | Delete
return (bool) apply_filters( 'wpforms_fields_show_options_setting', false );
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
/**
[27] Fix | Delete
* Return field choice properties for field configured with dynamic choices.
[28] Fix | Delete
*
[29] Fix | Delete
* @since 1.4.5
[30] Fix | Delete
*
[31] Fix | Delete
* @param array $field Field settings.
[32] Fix | Delete
* @param int $form_id Form ID.
[33] Fix | Delete
* @param array $form_data Form data and settings.
[34] Fix | Delete
*
[35] Fix | Delete
* @return false|array
[36] Fix | Delete
*/
[37] Fix | Delete
function wpforms_get_field_dynamic_choices( $field, $form_id, $form_data = [] ) {
[38] Fix | Delete
[39] Fix | Delete
if ( empty( $field['dynamic_choices'] ) ) {
[40] Fix | Delete
return false;
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
$choices = [];
[44] Fix | Delete
[45] Fix | Delete
if ( $field['dynamic_choices'] === 'post_type' ) {
[46] Fix | Delete
[47] Fix | Delete
if ( empty( $field['dynamic_post_type'] ) ) {
[48] Fix | Delete
return false;
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
$posts = wpforms_get_hierarchical_object(
[52] Fix | Delete
/**
[53] Fix | Delete
* Filter the arguments used to retrieve posts for dynamic choices.
[54] Fix | Delete
*
[55] Fix | Delete
* @since 1.4.5
[56] Fix | Delete
*
[57] Fix | Delete
* @param array $args Array of arguments for retrieving posts.
[58] Fix | Delete
* @param array $field Field settings.
[59] Fix | Delete
* @param int $form_id Form ID.
[60] Fix | Delete
*/
[61] Fix | Delete
apply_filters(
[62] Fix | Delete
'wpforms_dynamic_choice_post_type_args',
[63] Fix | Delete
[
[64] Fix | Delete
'post_type' => $field['dynamic_post_type'],
[65] Fix | Delete
'posts_per_page' => -1,
[66] Fix | Delete
'orderby' => 'title',
[67] Fix | Delete
'order' => 'ASC',
[68] Fix | Delete
],
[69] Fix | Delete
$field,
[70] Fix | Delete
$form_id
[71] Fix | Delete
),
[72] Fix | Delete
true
[73] Fix | Delete
);
[74] Fix | Delete
[75] Fix | Delete
foreach ( $posts as $post ) {
[76] Fix | Delete
$choices[] = [
[77] Fix | Delete
'value' => $post->ID,
[78] Fix | Delete
'label' => wpforms_get_post_title( $post ),
[79] Fix | Delete
'depth' => isset( $post->depth ) ? absint( $post->depth ) : 1,
[80] Fix | Delete
];
[81] Fix | Delete
}
[82] Fix | Delete
} elseif ( $field['dynamic_choices'] === 'taxonomy' ) {
[83] Fix | Delete
[84] Fix | Delete
if ( empty( $field['dynamic_taxonomy'] ) ) {
[85] Fix | Delete
return false;
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
$terms = wpforms_get_hierarchical_object(
[89] Fix | Delete
/**
[90] Fix | Delete
* Filter the arguments used to retrieve terms for dynamic choices.
[91] Fix | Delete
*
[92] Fix | Delete
* @since 1.4.5
[93] Fix | Delete
*
[94] Fix | Delete
* @param array $args Array of arguments for retrieving terms.
[95] Fix | Delete
* @param array $field Field settings.
[96] Fix | Delete
* @param array $form_data Form data.
[97] Fix | Delete
*/
[98] Fix | Delete
apply_filters(
[99] Fix | Delete
'wpforms_dynamic_choice_taxonomy_args',
[100] Fix | Delete
[
[101] Fix | Delete
'taxonomy' => $field['dynamic_taxonomy'],
[102] Fix | Delete
'hide_empty' => false,
[103] Fix | Delete
],
[104] Fix | Delete
$field,
[105] Fix | Delete
$form_data
[106] Fix | Delete
),
[107] Fix | Delete
true
[108] Fix | Delete
);
[109] Fix | Delete
[110] Fix | Delete
foreach ( $terms as $term ) {
[111] Fix | Delete
$choices[] = [
[112] Fix | Delete
'value' => $term->term_id,
[113] Fix | Delete
'label' => wpforms_get_term_name( $term ),
[114] Fix | Delete
'depth' => isset( $term->depth ) ? absint( $term->depth ) : 1,
[115] Fix | Delete
];
[116] Fix | Delete
}
[117] Fix | Delete
}
[118] Fix | Delete
[119] Fix | Delete
return $choices;
[120] Fix | Delete
}
[121] Fix | Delete
[122] Fix | Delete
/**
[123] Fix | Delete
* Build and return either a taxonomy or post type object nested to accommodate any hierarchy.
[124] Fix | Delete
*
[125] Fix | Delete
* @since 1.3.9
[126] Fix | Delete
* @since 1.5.0 Return an array only. Empty array of no data.
[127] Fix | Delete
*
[128] Fix | Delete
* @param array $args Object arguments to pass to data retrieval function.
[129] Fix | Delete
* @param bool $flat Preserve hierarchy or not. False by default - preserve it.
[130] Fix | Delete
*
[131] Fix | Delete
* @return array
[132] Fix | Delete
*/
[133] Fix | Delete
function wpforms_get_hierarchical_object( $args = [], $flat = false ): array { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh, Generic.Metrics.NestingLevel.MaxExceeded
[134] Fix | Delete
[135] Fix | Delete
if ( empty( $args['taxonomy'] ) && empty( $args['post_type'] ) ) {
[136] Fix | Delete
return [];
[137] Fix | Delete
}
[138] Fix | Delete
[139] Fix | Delete
$children = [];
[140] Fix | Delete
$parents = [];
[141] Fix | Delete
$ref_parent = '';
[142] Fix | Delete
$ref_name = '';
[143] Fix | Delete
$number = 0;
[144] Fix | Delete
[145] Fix | Delete
if ( ! empty( $args['post_type'] ) ) {
[146] Fix | Delete
[147] Fix | Delete
$defaults = [
[148] Fix | Delete
'posts_per_page' => - 1,
[149] Fix | Delete
'orderby' => 'title',
[150] Fix | Delete
'order' => 'ASC',
[151] Fix | Delete
];
[152] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[153] Fix | Delete
$items = get_posts( $args );
[154] Fix | Delete
$ref_parent = 'post_parent';
[155] Fix | Delete
$ref_id = 'ID';
[156] Fix | Delete
$ref_name = 'post_title';
[157] Fix | Delete
$number = ! empty( $args['posts_per_page'] ) ? $args['posts_per_page'] : 0;
[158] Fix | Delete
[159] Fix | Delete
} elseif ( ! empty( $args['taxonomy'] ) ) {
[160] Fix | Delete
[161] Fix | Delete
$defaults = [
[162] Fix | Delete
'hide_empty' => false,
[163] Fix | Delete
'orderby' => 'name',
[164] Fix | Delete
'order' => 'ASC',
[165] Fix | Delete
];
[166] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[167] Fix | Delete
$items = get_terms( $args );
[168] Fix | Delete
$ref_parent = 'parent';
[169] Fix | Delete
$ref_id = 'term_id';
[170] Fix | Delete
$ref_name = 'name';
[171] Fix | Delete
$number = ! empty( $args['number'] ) ? $args['number'] : 0;
[172] Fix | Delete
}
[173] Fix | Delete
[174] Fix | Delete
if ( empty( $items ) || is_wp_error( $items ) ) {
[175] Fix | Delete
return [];
[176] Fix | Delete
}
[177] Fix | Delete
[178] Fix | Delete
foreach ( $items as $item ) {
[179] Fix | Delete
if ( $item->{$ref_parent} ) {
[180] Fix | Delete
$children[ $item->{$ref_id} ] = $item;
[181] Fix | Delete
$children[ $item->{$ref_id} ]->ID = (int) $item->{$ref_id};
[182] Fix | Delete
} else {
[183] Fix | Delete
$parents[ $item->{$ref_id} ] = $item;
[184] Fix | Delete
$parents[ $item->{$ref_id} ]->ID = (int) $item->{$ref_id};
[185] Fix | Delete
}
[186] Fix | Delete
}
[187] Fix | Delete
[188] Fix | Delete
$children_count = count( $children );
[189] Fix | Delete
$is_limited = $number > 1;
[190] Fix | Delete
[191] Fix | Delete
// We can't guarantee that all children have a parent if there is a limit in the request.
[192] Fix | Delete
// Hence, we have to make sure that there is a parent for every child.
[193] Fix | Delete
if ( $is_limited && $children_count ) {
[194] Fix | Delete
foreach ( $children as $child ) {
[195] Fix | Delete
// The current WP_Post or WP_Term object to operate on.
[196] Fix | Delete
$current = $child;
[197] Fix | Delete
[198] Fix | Delete
// The current object's parent is already in the list of parents or children.
[199] Fix | Delete
if ( ! empty( $parents[ $child->{$ref_parent} ] ) || ! empty( $children[ $child->{$ref_parent} ] ) ) {
[200] Fix | Delete
continue;
[201] Fix | Delete
}
[202] Fix | Delete
[203] Fix | Delete
do {
[204] Fix | Delete
// Set the current object to the previous iteration's parent object.
[205] Fix | Delete
$current = ! empty( $args['post_type'] ) ? get_post( $current->{$ref_parent} ) : get_term( $current->{$ref_parent} );
[206] Fix | Delete
[207] Fix | Delete
if ( $current->{$ref_parent} === 0 ) {
[208] Fix | Delete
// We've reached the top of the hierarchy.
[209] Fix | Delete
$parents[ $current->{$ref_id} ] = $current;
[210] Fix | Delete
$parents[ $current->{$ref_id} ]->ID = (int) $current->{$ref_id};
[211] Fix | Delete
} else {
[212] Fix | Delete
// We're still in the middle of the hierarchy.
[213] Fix | Delete
$children[ $current->{$ref_id} ] = $current;
[214] Fix | Delete
$children[ $current->{$ref_id} ]->ID = (int) $current->{$ref_id};
[215] Fix | Delete
}
[216] Fix | Delete
} while ( $current->{$ref_parent} > 0 );
[217] Fix | Delete
}
[218] Fix | Delete
}
[219] Fix | Delete
[220] Fix | Delete
while ( $children_count >= 1 ) {
[221] Fix | Delete
foreach ( $children as $child ) {
[222] Fix | Delete
_wpforms_get_hierarchical_object_search( $child, $parents, $children, $ref_parent );
[223] Fix | Delete
[224] Fix | Delete
// $children is modified by reference, so we need to recount to make sure we met the limits.
[225] Fix | Delete
$children_count = count( $children );
[226] Fix | Delete
}
[227] Fix | Delete
}
[228] Fix | Delete
[229] Fix | Delete
// Sort nested child objects alphabetically using natural order, applies only
[230] Fix | Delete
// to ordering by entry title or term name.
[231] Fix | Delete
if ( in_array( $args['orderby'], [ 'title', 'name' ], true ) ) {
[232] Fix | Delete
_wpforms_sort_hierarchical_object( $parents, $args['orderby'], $args['order'] );
[233] Fix | Delete
}
[234] Fix | Delete
[235] Fix | Delete
if ( $flat ) {
[236] Fix | Delete
$parents_flat = [];
[237] Fix | Delete
[238] Fix | Delete
_wpforms_get_hierarchical_object_flatten( $parents, $parents_flat, $ref_name );
[239] Fix | Delete
[240] Fix | Delete
$parents = $parents_flat;
[241] Fix | Delete
}
[242] Fix | Delete
[243] Fix | Delete
return $is_limited ? array_slice( $parents, 0, $number ) : $parents;
[244] Fix | Delete
}
[245] Fix | Delete
[246] Fix | Delete
/**
[247] Fix | Delete
* Sort a nested array of objects.
[248] Fix | Delete
*
[249] Fix | Delete
* @since 1.6.5
[250] Fix | Delete
*
[251] Fix | Delete
* @param array $objects An array of objects to sort.
[252] Fix | Delete
* @param string $orderby The object field to order by.
[253] Fix | Delete
* @param string $order Order direction.
[254] Fix | Delete
*/
[255] Fix | Delete
function _wpforms_sort_hierarchical_object( $objects, $orderby, $order ) {
[256] Fix | Delete
[257] Fix | Delete
// Map WP_Query/WP_Term_Query orderby to WP_Post/WP_Term property.
[258] Fix | Delete
$map = [
[259] Fix | Delete
'title' => 'post_title',
[260] Fix | Delete
'name' => 'name',
[261] Fix | Delete
];
[262] Fix | Delete
[263] Fix | Delete
foreach ( $objects as $object ) {
[264] Fix | Delete
if ( ! isset( $object->children ) ) {
[265] Fix | Delete
continue;
[266] Fix | Delete
}
[267] Fix | Delete
[268] Fix | Delete
uasort(
[269] Fix | Delete
$object->children,
[270] Fix | Delete
static function ( $a, $b ) use ( $map, $orderby, $order ) {
[271] Fix | Delete
[272] Fix | Delete
/**
[273] Fix | Delete
* This covers most cases and works for most languages.
[274] Fix | Delete
* For some – e.g.,
[275] Fix | Delete
* European languages that use extended latin charset (Polish, German, etc.)
[276] Fix | Delete
* it will sort the objects into two groups – base and extended, properly sorted within each group.
[277] Fix | Delete
* Making it even more robust requires either additional PHP extensions to be installed on the server
[278] Fix | Delete
* or using heavy (and slow) conversions and computations.
[279] Fix | Delete
*/
[280] Fix | Delete
return $order === 'ASC' ?
[281] Fix | Delete
strnatcasecmp( $a->{$map[ $orderby ]}, $b->{$map[ $orderby ]} ) :
[282] Fix | Delete
strnatcasecmp( $b->{$map[ $orderby ]}, $a->{$map[ $orderby ]} );
[283] Fix | Delete
}
[284] Fix | Delete
);
[285] Fix | Delete
[286] Fix | Delete
_wpforms_sort_hierarchical_object( $object->children, $orderby, $order );
[287] Fix | Delete
}
[288] Fix | Delete
}
[289] Fix | Delete
[290] Fix | Delete
/**
[291] Fix | Delete
* Search a given array and find the parent of the provided object.
[292] Fix | Delete
*
[293] Fix | Delete
* @since 1.3.9
[294] Fix | Delete
*
[295] Fix | Delete
* @param object $child Current child.
[296] Fix | Delete
* @param array $parents Parents list.
[297] Fix | Delete
* @param array $children Children list.
[298] Fix | Delete
* @param string $ref_parent Parent reference.
[299] Fix | Delete
*/
[300] Fix | Delete
function _wpforms_get_hierarchical_object_search( $child, &$parents, &$children, $ref_parent ) {
[301] Fix | Delete
[302] Fix | Delete
foreach ( $parents as $parent ) {
[303] Fix | Delete
if ( $parent->ID === $child->{$ref_parent} ) {
[304] Fix | Delete
$parent->children = $parent->children ?? [];
[305] Fix | Delete
$parent->children[ $child->ID ] = $child;
[306] Fix | Delete
[307] Fix | Delete
unset( $children[ $child->ID ] );
[308] Fix | Delete
} elseif ( ! empty( $parent->children ) && is_array( $parent->children ) ) {
[309] Fix | Delete
_wpforms_get_hierarchical_object_search( $child, $parent->children, $children, $ref_parent );
[310] Fix | Delete
}
[311] Fix | Delete
}
[312] Fix | Delete
}
[313] Fix | Delete
[314] Fix | Delete
/**
[315] Fix | Delete
* Flatten a hierarchical object.
[316] Fix | Delete
*
[317] Fix | Delete
* @since 1.3.9
[318] Fix | Delete
*
[319] Fix | Delete
* @param array $h_array Hierarchical array to process.
[320] Fix | Delete
* @param array $output Processed output.
[321] Fix | Delete
* @param string $ref_name Name reference.
[322] Fix | Delete
* @param int $level Nesting level.
[323] Fix | Delete
*/
[324] Fix | Delete
function _wpforms_get_hierarchical_object_flatten( $h_array, &$output, $ref_name = 'name', $level = 0 ) {
[325] Fix | Delete
[326] Fix | Delete
/**
[327] Fix | Delete
* Filter the hierarchical object indicator.
[328] Fix | Delete
*
[329] Fix | Delete
* @since 1.3.9
[330] Fix | Delete
*
[331] Fix | Delete
* @param string $indicator Hierarchical object indicator.
[332] Fix | Delete
*/
[333] Fix | Delete
$indicator = (string) apply_filters( 'wpforms_hierarchical_object_indicator', '&mdash;' );
[334] Fix | Delete
[335] Fix | Delete
foreach ( $h_array as $item ) {
[336] Fix | Delete
$item->{$ref_name} = str_repeat( $indicator, $level ) . ' ' . $item->{$ref_name};
[337] Fix | Delete
$item->depth = $level + 1;
[338] Fix | Delete
$output[ $item->ID ] = $item;
[339] Fix | Delete
[340] Fix | Delete
if ( ! empty( $item->children ) ) {
[341] Fix | Delete
_wpforms_get_hierarchical_object_flatten( $item->children, $output, $ref_name, $level + 1 );
[342] Fix | Delete
unset( $output[ $item->ID ]->children );
[343] Fix | Delete
}
[344] Fix | Delete
}
[345] Fix | Delete
}
[346] Fix | Delete
[347] Fix | Delete
/**
[348] Fix | Delete
* Get sanitized post title or "no title" placeholder.
[349] Fix | Delete
*
[350] Fix | Delete
* The placeholder is prepended with the post ID.
[351] Fix | Delete
*
[352] Fix | Delete
* @since 1.7.6
[353] Fix | Delete
*
[354] Fix | Delete
* @param WP_Post|mixed $post Post object.
[355] Fix | Delete
*
[356] Fix | Delete
* @return string Post title.
[357] Fix | Delete
*/
[358] Fix | Delete
function wpforms_get_post_title( $post ): string {
[359] Fix | Delete
[360] Fix | Delete
return (
[361] Fix | Delete
wpforms_is_empty_string( trim( $post->post_title ) )
[362] Fix | Delete
/* translators: %d - post ID. */
[363] Fix | Delete
? sprintf( __( '#%d (no title)', 'wpforms-lite' ), absint( $post->ID ) )
[364] Fix | Delete
: $post->post_title
[365] Fix | Delete
);
[366] Fix | Delete
}
[367] Fix | Delete
[368] Fix | Delete
/**
[369] Fix | Delete
* Get a sanitized term name or "no name" placeholder.
[370] Fix | Delete
*
[371] Fix | Delete
* The placeholder is prepended with the term ID.
[372] Fix | Delete
*
[373] Fix | Delete
* @since 1.7.6
[374] Fix | Delete
*
[375] Fix | Delete
* @param WP_Term $term Term object.
[376] Fix | Delete
*
[377] Fix | Delete
* @return string Term name.
[378] Fix | Delete
*/
[379] Fix | Delete
function wpforms_get_term_name( WP_Term $term ): string {
[380] Fix | Delete
[381] Fix | Delete
return (
[382] Fix | Delete
wpforms_is_empty_string( trim( $term->name ) )
[383] Fix | Delete
/* translators: %d - taxonomy term ID. */
[384] Fix | Delete
? sprintf( __( '#%d (no name)', 'wpforms-lite' ), absint( $term->term_id ) )
[385] Fix | Delete
: trim( $term->name )
[386] Fix | Delete
);
[387] Fix | Delete
}
[388] Fix | Delete
[389] Fix | Delete
/**
[390] Fix | Delete
* Return information about pages if the form has multiple pages.
[391] Fix | Delete
*
[392] Fix | Delete
* @since 1.3.7
[393] Fix | Delete
*
[394] Fix | Delete
* @param WP_Post|array $form Form data.
[395] Fix | Delete
*
[396] Fix | Delete
* @return false|array Page Break details or false.
[397] Fix | Delete
*/
[398] Fix | Delete
function wpforms_get_pagebreak_details( $form = false ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
[399] Fix | Delete
[400] Fix | Delete
if ( ! wpforms()->is_pro() ) {
[401] Fix | Delete
return false;
[402] Fix | Delete
}
[403] Fix | Delete
[404] Fix | Delete
$details = [];
[405] Fix | Delete
$pages = 1;
[406] Fix | Delete
[407] Fix | Delete
if ( is_object( $form ) && ! empty( $form->post_content ) ) {
[408] Fix | Delete
$form_data = wpforms_decode( $form->post_content );
[409] Fix | Delete
} elseif ( is_array( $form ) ) {
[410] Fix | Delete
$form_data = $form;
[411] Fix | Delete
}
[412] Fix | Delete
[413] Fix | Delete
if ( empty( $form_data['fields'] ) ) {
[414] Fix | Delete
return false;
[415] Fix | Delete
}
[416] Fix | Delete
[417] Fix | Delete
foreach ( $form_data['fields'] as $field ) {
[418] Fix | Delete
[419] Fix | Delete
if ( $field['type'] !== 'pagebreak' ) {
[420] Fix | Delete
continue;
[421] Fix | Delete
}
[422] Fix | Delete
[423] Fix | Delete
if ( empty( $field['position'] ) ) {
[424] Fix | Delete
++$pages;
[425] Fix | Delete
[426] Fix | Delete
$details['total'] = $pages;
[427] Fix | Delete
$details['pages'][] = $field;
[428] Fix | Delete
} elseif ( $field['position'] === 'top' ) {
[429] Fix | Delete
$details['top'] = $field;
[430] Fix | Delete
} elseif ( $field['position'] === 'bottom' ) {
[431] Fix | Delete
$details['bottom'] = $field;
[432] Fix | Delete
}
[433] Fix | Delete
}
[434] Fix | Delete
[435] Fix | Delete
if ( ! empty( $details ) ) {
[436] Fix | Delete
$details['top'] = empty( $details['top'] ) ? [] : $details['top'];
[437] Fix | Delete
$details['bottom'] = empty( $details['bottom'] ) ? [] : $details['bottom'];
[438] Fix | Delete
$details['current'] = 1;
[439] Fix | Delete
[440] Fix | Delete
return $details;
[441] Fix | Delete
}
[442] Fix | Delete
[443] Fix | Delete
return false;
[444] Fix | Delete
}
[445] Fix | Delete
[446] Fix | Delete
/**
[447] Fix | Delete
* Return available builder fields.
[448] Fix | Delete
*
[449] Fix | Delete
* @since 1.8.5
[450] Fix | Delete
*
[451] Fix | Delete
* @param string $group Group name.
[452] Fix | Delete
*
[453] Fix | Delete
* @return array
[454] Fix | Delete
*/
[455] Fix | Delete
function wpforms_get_builder_fields( string $group = '' ): array {
[456] Fix | Delete
[457] Fix | Delete
$fields = [
[458] Fix | Delete
'standard' => [
[459] Fix | Delete
'group_name' => esc_html__( 'Standard Fields', 'wpforms-lite' ),
[460] Fix | Delete
'fields' => [],
[461] Fix | Delete
],
[462] Fix | Delete
'fancy' => [
[463] Fix | Delete
'group_name' => esc_html__( 'Fancy Fields', 'wpforms-lite' ),
[464] Fix | Delete
'fields' => [],
[465] Fix | Delete
],
[466] Fix | Delete
'payment' => [
[467] Fix | Delete
'group_name' => esc_html__( 'Payment Fields', 'wpforms-lite' ),
[468] Fix | Delete
'fields' => [],
[469] Fix | Delete
],
[470] Fix | Delete
];
[471] Fix | Delete
[472] Fix | Delete
/**
[473] Fix | Delete
* Allows developers to modify the content of the Add Field tab.
[474] Fix | Delete
*
[475] Fix | Delete
* With this filter, developers can add their own fields or even fields groups.
[476] Fix | Delete
*
[477] Fix | Delete
* @since 1.4.0
[478] Fix | Delete
*
[479] Fix | Delete
* @param array $fields {
[480] Fix | Delete
* Fields data multidimensional array.
[481] Fix | Delete
*
[482] Fix | Delete
* @param array $standard Standard fields group.
[483] Fix | Delete
* @param string $group_name Group name.
[484] Fix | Delete
* @param array $fields Fields array.
[485] Fix | Delete
*
[486] Fix | Delete
* @param array $fancy Fancy fields group.
[487] Fix | Delete
* @param string $group_name Group name.
[488] Fix | Delete
* @param array $fields Fields array.
[489] Fix | Delete
*
[490] Fix | Delete
* @param array $payment Payment fields group.
[491] Fix | Delete
* @param string $group_name Group name.
[492] Fix | Delete
* @param array $fields Fields array.
[493] Fix | Delete
* }
[494] Fix | Delete
*/
[495] Fix | Delete
$fields = apply_filters( 'wpforms_builder_fields_buttons', $fields ); // phpcs:ignore WPForms.Comments.ParamTagHooks.InvalidParamTagsQuantity
[496] Fix | Delete
[497] Fix | Delete
// If a group is not specified, return all fields.
[498] Fix | Delete
if ( empty( $group ) ) {
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function