Custom field in GF_Fields::create

Hi,

I’m programatically creating consent fields from a custom post type & ACF. The label field, which loaded from ACF ($nazev_souhlasu) is loading & saving correctly. However, the field description is not loading correctly. Somehow, the number 45 is always getting saved as the meta value.

Could you please check the code below and let me know, if Im assigning $text_suhlasu correctly to the field description?

// DATA FOR GRAVITY FORMS FIELD
$souhlas_post_id = get_the_id();
					$checkbox_text = get_field('checkbox_text', $souhlas_post_id);
					$text_suhlasu = get_field('text_suhlasu', $souhlas_post_id);

					$nazev_souhlasu = 'Súhlas č. ' . $souhlas_counter; 
					$id_souhlasu = 1200 + $souhlas_counter;
					$nazev_souhlasu = GF_Fields::create( array(
						'type'   => 'consent',
						'id'     => $id_souhlasu, // The Field ID must be unique on the form
						'formId' => $form['id'],
						'isRequired' => true,
						'label'  => $nazev_souhlasu,
						'checkboxLabel' => $checkbox_text,
						'description' => $text_suhlasu,
						'inputs' => array(
							array(
								"id" => $id_souhlasu . ".1",
								"label" => "Consent",
								"name" => "",
							),
							array(
								"id" => $id_souhlasu . ".2",
								"label" => "Text",
								"name" => "",
								"isHidden" => true,
							),
							array(
								"id" => $id_souhlasu . ".3",
								"label" => "Description",
								"name" => "",
								"isHidden" => true,
							)
						),
						'pageNumber'  => 1, // Ensure this is correct
					) );
					
					$form['fields'][] = $nazev_souhlasu;

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.