function _generateWidget($code_writer)
 {
     parent::_generateWidget($code_writer);
     if ($form_tag = $this->findParentByClass('lmbMacroFormTag')) {
         $code_writer->writeToInit("{$this->getRuntimeVar()}->setForm({$form_tag->getRuntimeVar()});\n");
         $code_writer->writeToInit("{$form_tag->getRuntimeVar()}->addChild({$this->getRuntimeVar()});\n");
     }
 }
Example #2
0
 protected function _generateBeforeOpeningTag($code)
 {
     $form = $this->getRuntimeVar();
     // passing specified variable as a datasource to form widget
     if ($this->has('from')) {
         $from = $this->get('from');
         $code->writePHP("{$form}->setDatasource({$from});\n");
         $this->remove('from');
     }
     // passing specially named variable of the compiled template as a datasource to form widget if the variable if defined
     $datasource_id = $form . '_datasource';
     $code->writePHP("if(isset({$datasource_id})){$form}->setDatasource({$datasource_id});\n");
     // passing specially named variable of the compiled template as an error_list to form widget if the variable if defined
     $error_list_id = $form . '_error_list';
     $code->writePHP("if(isset({$error_list_id})){$form}->setErrorList({$error_list_id});\n");
     parent::_generateBeforeOpeningTag($code);
 }