[Domain Mapping] NBT Gravity Form integration hook to show specific template is not working

At this thread you guys gave a code to show just a specific template at a chosen Gravity Forms form: https://premium.wpmudev.org/forums/topic/select-a-specific-new-blog-template-using-gravity-forms#post-1206937

However, it is not really working. It just shows the templates instead the checkbox input field, but nothing happens if I chose a specific template there. But I don`t want just a specific template either. I would like, actually, to be able to choose a specific template category to bring its templates attached at my chosen form. Below is the given thread hook code. What should I change in it in order to get that?

<?php

add_filter( 'gform_userregistration_feed_settings_fields', function( $settings ) {
if ( ! function_exists( 'nbt_get_model' ) )
return $settings;

$model = nbt_get_model();
$templates = $model->get_templates();
$choices = array(
array(
'label' => 'Select template',
'value' => 0
)
);
foreach ( $templates as $template_id => $template ) {
$choices[] = array(
'label' => esc_html( $template['name'] ),
'value' => $template['ID']
);
}

$settings['nbt'] = array(
'title' => __( 'New Blog Templates', 'blog_templates' ),
'description' => '',
'dependency' => array(),
'fields' => array(
array(
'name' => 'gf_user_registration_multisite_blog_templates_template_id',
'label' => __( 'Template', 'blog_templates' ),
'type' => 'select',
'choices' => $choices
)
)
);
return $settings;
}, 50);

add_filter( 'gform_submit_button', 'nbt_hooks_render_hidden_form_field', 15, 2 );
function nbt_hooks_render_hidden_form_field( $button_input, $form ) {
$user_registration = gf_user_registration();
$config = $user_registration->get_feed( $form['id'] );
$template_id = absint( rgar( $config['meta'], 'gf_user_registration_multisite_blog_templates_template_id' ) );

if ( $template_id ) {

if ( ! function_exists( 'nbt_get_model' ) )
return $button_input;

$model = nbt_get_model();

if ( ! $model->get_template( $template_id ) )
return $button_input;

$button_input .= ' <input type="hidden" class="gform_hidden" name="blog_template" value="' . $template_id . '" />';

}

return $button_input;
}

Thank you very much! :wink: