Gravity prerender taxonomy [closed]

Scoured the web and modified a snippet, in case anybody is interested:

<?php

add_filter("gform_pre_render", "gform_prepopluate_populate_books");
add_filter("gform_admin_pre_render", "gform_prepopluate_populate_books");

function gform_prepopluate_populate_books($form){

    //Grab all Terms Associated with a Specific Taxonomy;
    global $post;
    $taxonomy = 'genres';
    $formid = 5;
    $fieldid = 14;

    if($form["id"] != $formid)
        return $form;
    $terms = get_terms($taxonomy, 'hide_empty=0&orderby=none');

    //Creating drop down item array.
    $items = array();

    //Adding initial blank value.
    $items[] = array("text" => "", "value" => "");

    //Adding term names to the items array
    foreach($terms as $term){
        $is_selected = $term->name == "testing" ? true : false;
        $items[] = array("value" => $term->name, "text" => $term->name, "isSelected"=> $is_selected);
    }

    //Adding items to field id 1. Replace 1 with your actual field id. You can get the field id by looking at the input name in the markup.
    foreach($form["fields"] as &$field)
        if($field["id"] == $fieldid){
            $field["type"] = "select";
            $field["choices"] = $items;
        }

    return $form;
}