get_token_factory()->variable( $field_id )->add_item_path( 'value' ); $markup_field_data->get_token_factory()->to_echo( $var )->print(); } /** * @return array */ public function get_template_variables( Variable_Field_Data $variable_field_data ): array { $twig_args = array( 'value' => '', ); $value = is_string( $variable_field_data->get_value() ) || is_numeric( $variable_field_data->get_value() ) ? (string) $variable_field_data->get_value() : ''; return array_merge( $twig_args, array( 'value' => $value, ) ); } /** * @return array */ public function get_validation_template_variables( Variable_Field_Data $variable_field_data ): array { return array( 'value' => '1', ); } public function is_with_field_wrapper( Layout_Settings $layout_settings, Field_Settings $field_settings, Field_Meta $field_meta ): bool { return true; } public function get_custom_field_wrapper_tag(): string { return 'p'; } }