gform_advancedpostcreation_file_fields_choices

gform_advancedpostcreation_file_fields_choices

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
Allows the available choices for the media settings to be overridden on the feed configuration page.
Usage
add_filter( 'gform_advancedpostcreation_file_fields_choices', 'your_function_name', 10, 3 );

Parameters

$choices array
The file fields as choices.

$form Form Object
The current form.

$single_file bool
Indicates if only single file upload fields should be returned.

Examples
add_filter( 'gform_advancedpostcreation_file_fields_choices', 'filter_choices', 10, 3 );
function filter_choices( $choices, $form, $single_file ){
$filtered_choices = array();
foreach ( $choices as $choice )
{
if ($choice['label'] == 'Not For Media'){
continue;
}
$filtered_choices[] = $choice;
}
return $filtered_choices;
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in the Gravity Forms Advanced Post Creation version 1.0-beta-2.2.
Source Code
This filter is located in GF_Advanced_Post_Creation::get_file_fields_as_choices() in gravityformsadvancedpostcreation/class-gf-advancedpostcreation.php.

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注