Factory/JsFormValidatorFactory.php
public function createJsModel(Form $form)
    {
        $this->currentElement = $form;

        $conf = $form->getConfig();
        // If field is disabled or has no any validations
        if (false === $conf->getOption('js_validation')) {
            return null;
        }

        $model                 = new JsFormElement;
        $model->id             = $this->getElementId($form);
        $model->name           = $form->getName();
        $model->type           = get_class($conf->getType()->getInnerType());
        $model->invalidMessage = $this->translateMessage(
            $conf->getOption('invalid_message'),
            $conf->getOption('invalid_message_parameters')
        );
        $model->transformers   = $this->normalizeViewTransformers(
            $form,
            $this->parseTransformers($conf->getViewTransformers())
        );
        $model->bubbling       = $conf->getOption('error_bubbling');
        $model->data           = $this->getValidationData($form);
        $model->children       = $this->processChildren($form);

        $prototype = $form->getConfig()->getAttribute('prototype');
        if ($prototype) {
            $model->prototype = $this->createJsModel($prototype);
        }

        // Return self id to add it as child to the parent model
        return $model;
    }
public function createJsModel(Form $form)
    {
        $this->currentElement = $form;

        $conf = $form->getConfig();
        // If field is disabled or has no any validations
        if (false === $conf->getOption('js_validation')) {
            return null;
        }

        $model                 = new JsFormElement;
        $model->id             = $this->getElementId($form);
        $model->name           = $form->getName();
        $model->type           = get_class($conf->getType()->getInnerType());
        $model->invalidMessage = $this->translateMessage(
            $conf->getOption('invalid_message'),
            $conf->getOption('invalid_message_parameters')
        );
        $model->transformers   = $this->normalizeViewTransformers(
            $form,
            $this->parseTransformers($conf->getViewTransformers())
        );
        $model->bubbling       = $conf->getOption('error_bubbling');
        $model->data           = $this->getValidationData($form);
        $model->children       = $this->processChildren($form);

        $prototype = $form->getConfig()->getAttribute('prototype');
        if ($prototype) {
            $model->prototype = $this->createJsModel($prototype);
        }

        // Return self id to add it as child to the parent model
        return $model;
    }
public function createJsModel ( Form $ form ) { $ this -> currentElement = $ form ; $ conf = $ form -> getConfig ( ) ; // If field is disabled or has no any validations if ( false === $ conf -> getOption ( 'js_validation' ) ) { return null ; } $ model = new JsFormElement ; $ model -> id = $ this -> getElementId ( $ form ) ; $ model -> name = $ form -> getName ( ) ; $ model -> type = get_class ( $ conf -> getType ( ) -> getInnerType ( ) ) ; $ model -> invalidMessage = $ this -> translateMessage ( $ conf -> getOption ( 'invalid_message' ) , $ conf -> getOption ( 'invalid_message_parameters' ) ) ; $ model -> transformers = $ this -> normalizeViewTransformers ( $ form , $ this -> parseTransformers ( $ conf -> getViewTransformers ( ) ) ) ; $ model -> bubbling = $ conf -> getOption ( 'error_bubbling' ) ; $ model -> data = $ this -> getValidationData ( $ form ) ; $ model -> children = $ this -> processChildren ( $ form ) ; $ prototype = $ form -> getConfig ( ) -> getAttribute ( 'prototype' ) ; if ( $ prototype ) { $ model -> prototype = $ this -> createJsModel ( $ prototype ) ; } // Return self id to add it as child to the parent model return $ model ; }
The main function that creates nested model

@param Form $form

@return null|JsFormElement
The main function that creates nested model