Created
May 22, 2018 15:23
-
-
Save kjohnson/d6b72578e2451adb13b3d50693f0a06c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change a field's settings when localized to the page. | |
* | |
* @param array $field [ id, settings => [ type, key, label, etc. ] ] | |
* @return array $field | |
*/ | |
add_filter( 'ninja_forms_localize_field', function( $field ){ | |
if( 'my_field' == $field[ 'settings' ][ 'key' ] ) { | |
// Change the label setting of the field. | |
$field[ 'settings' ][ 'label' ] = 'New Field Label'; | |
} | |
return $field; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change a number field's settings when localized to the page. | |
* | |
* @param array $field [ id, settings => [ type, key, label, etc. ] ] | |
* @return array $field | |
*/ | |
add_filter( 'ninja_forms_localize_field_number', function( $field ){ | |
// Change the label setting of the field. | |
$field[ 'settings' ][ 'label' ] = 'New Number Field Label'; | |
return $field; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change a field's settings when localized to the page. | |
* | |
* @param array $field [ id, settings => [ type, key, label, etc. ] ] | |
* @return array $field | |
*/ | |
add_filter( 'ninja_forms_localize_field', function( $field ){ | |
// Change the label setting of the field. | |
$field[ 'settings' ][ 'label' ] = 'New Field Label'; | |
return $field; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It appears that the dynamic-field-settings.php filter name should be
ninja_forms_localize_fields
(plural), notninja_forms_localize_field
.