gform_form_editor_can_field_be_added

gform_form_editor_can_field_be_added

DescriptionUsageParametersExampleSource Code

Description
This filter fires on the Form Editor page when a field button is clicked or dragged on to the form, it can be used to prevent a field being added to the form if the conditions you define are not met.
Usage
1234gform.addFilter('gform_form_editor_can_field_be_added', function (canFieldBeAdded, type) {    // return false to prevent a field being added.    return canFieldBeAdded;});

Parameters

canFieldBeAdded boolean
Defaults to true.

type string
The current field type.

Example
This example uses the gform_admin_pre_render filter to load the hook on the form editor page.
1234567891011121314151617181920add_filter( 'gform_admin_pre_render', function ( $form ) {    echo GFCommon::is_form_editor() ? "        " : '';     //return the form object from the php hook    return $form;} );
Source Code
This filter is located in js.php

發表回覆

您的郵箱地址不會被公開。 必填項已用 * 標註