• Resolved malkieblmg

    (@malkieblmg)


    Hi,
    I separated my name field into two columns and now I am trying to change the field labels but I can’t get it to work.
    This is what I did:

    add_filter(‘gfexcel_field_label’, function($label, GF_Field $field) {
    if ($field->formId === 2 && $field->id === 38.3) {
    return ‘First Name’;
    }

    return $label;
    }, 10, 2);

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Doeke Norg

    (@doekenorg)

    hi @malkieblmg ,

    try this:

    add_filter( 'gfexcel_field_label_name_2_38', function ( $label ) {
    	$mapping = [
    		'First Name' => 'New First Name',
    		'Last Name'  => 'New Last Name',
    	];
    
    	return $mapping[ $label ] ?? $label;
    } );

    Unfortunately there is no way to target the specific subfield at the moment, so this is a crude check on the current label => new label. It would be nice to have the sub-id of the field as well. I’ll add it to the issues.

    Hope this helps!

    Thread Starter malkieblmg

    (@malkieblmg)

    That worked!
    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change Label for Name Field’ is closed to new replies.