<commit_before>/**
 * dynform field - allows nesting of forms
 *
 * @param {Object} field_descriptor field specific part of the form schema
 * @param {Object} field_data initial value for the field
 * @param {Object} parent_dynform reference to the dynform instance that contains this field
 * @constructor
 * @class schnipp.dynforms.fields.form
 * @extends schnipp.dynforms.abstract_field
 **/
schnipp.dynforms.fields.form = function(field_descriptor, field_data, parent_dynform) {
    var self = schnipp.dynforms.abstract_field(field_descriptor, field_data)
    self.form = schnipp.dynforms.form(field_descriptor, field_data, parent_dynform.fieldtypes)

    

    self.render = function() {
        self.dom.main = self.form.render()
        return self.dom.main
    }

    self._set = function(data) {
        return self.form.set_data(data)
    }

    self.get_data = function() {
        return self.form.get_data()
    }

    self.initialize = function() {
        self.form.initialize()
        self.form.events.bind('change', function(args) {
            self.events.fire('change', args)
        })
    }

    return self
}<commit_msg>monkeypatch get_root_form method in order to all sub fields to get their most outer root form.<commit_after>/**
 * dynform field - allows nesting of forms
 *
 * @param {Object} field_descriptor field specific part of the form schema
 * @param {Object} field_data initial value for the field
 * @param {Object} parent_dynform reference to the dynform instance that contains this field
 * @constructor
 * @class schnipp.dynforms.fields.form
 * @extends schnipp.dynforms.abstract_field
 **/
schnipp.dynforms.fields.form = function(field_descriptor, field_data, parent_dynform) {
    var self = schnipp.dynforms.abstract_field(field_descriptor, field_data, parent_dynform)
    self.form = schnipp.dynforms.form(field_descriptor, field_data, parent_dynform.fieldtypes)

    // monkeypatch the abstract's field get_form method in order to allow sub field to call it.
    // This enables subfield to access the most outer parent (root) form.
    self.form.get_root_form = self.get_root_form


    self.render = function() {
        self.dom.main = self.form.render()
        return self.dom.main
    }

    self._set = function(data) {
        return self.form.set_data(data)
    }

    self.get_data = function() {
        return self.form.get_data()
    }

    self.initialize = function() {
        self.form.initialize()
        self.form.events.bind('change', function(args) {
            self.events.fire('change', args)
        })
    }

    return self
}
{'fraction_non_alphanumeric': 0.10123171670515782, 'fraction_numerical': 0.0, 'mean_word_length': 3.205501618122977, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2997712', 'n_tokens_mistral': 782, 'n_tokens_neox': 761, 'n_words': 198}