gform_input_masks

gform_input_masks

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this filter to edit the list of built-in input masks that are displayed in the Text Field input mask setting. Useful when adding a new custom input mask that will be used repeatedly.
Usage
1add_filter( 'gform_input_masks', 'add_mask' );
Parameters

$masks array
Current list of masks to be filtered, in the following format:
123456789array(    'US Phone' => '(999) 999-9999',    'US Phone + Ext' => '(999) 999-9999? x99999',    'Date' => '99/99/9999',    'Tax ID' => '99-9999999',    'SSN' => '999-99-9999',    'Zip Code' => '99999',    'Full Zip Code' => '99999?-9999');

Examples
This example adds a new predefined mask for 「Product Key」.
12345add_filter( 'gform_input_masks', 'add_mask' );function add_mask( $masks ) {    $masks['Product Key'] = 'a*-999-a999';    return $masks;}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFFormsModel::get_input_masks() in forms_model.php.

發表回覆

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