<div class="col-md-12"> <?php $form = $this->stepForm; $pluginDestinationField = $form->get('tpc_plugin_destination'); $pluginDestinationValue = $pluginDestinationField->getValue(); $pluginDestinationOptions = $pluginDestinationField->getValueOptions(); //get the existing module field options $existingModuleField = $form->get('tpc_existing_module_name'); $existingModuleOptions = $existingModuleField->getValueOptions(); $form->prepare(); echo $this->form()->openTag($form); foreach ($form->getElements() as $key => $val) { ?> <div class="form-group" <?=( empty($val->getValue()) && ($key=='tpc_new_module_name' || $key=='tpc_existing_module_name')) ? 'style="display:none"' : ''?>> <?php $required = ''; if (!empty($val->getAttribute('required'))) { $required = '<sup>*</sup>'; } ?> <label class="d-flex flex-row justify-content-between" for="<?=$key?>"> <div class="label-text"><?=$val->getLabel().$required?></div> <div class="slider-open-tooltip"> <i class="fa fa-info-circle fa-lg float-right tip-info" data-toggle="tooltip" data-placement="left" title="" data-original-title="<?= $this->translate($val->getOptions()['tooltip'])?>"></i> </div> </label> <?php if ($key == 'tpc_plugin_name' ) {?> <div class="form-group input-group"> <input class="<?=$val->getAttribute('class')?>" type="text" id="<?=$key?>" name="<?=$key?>" required="required" value="<?=$val->getValue()?>"> </div> <?php } elseif ($key == 'tpc_plugin_destination') { ?> <div class="row"> <?php foreach ($pluginDestinationOptions as $optKey => $optVal) { ?> <div class="col-md-2 plugin-creator-radio"> <label class="melis-radio-box" for="<?=$optKey.$key?>"> <input class="<?=$val->getAttribute('class')?>" type="radio" value="<?=$optKey?>" name="<?=$key?>" id="<?= $optKey.$key?>" required="required" <?=$pluginDestinationValue == $optKey ? "checked" : ""?> /> <span><?=$optVal?></span> </label> </div> <?php } ?> </div> <?php } elseif ($key == 'tpc_new_module_name') { ?> <div class="form-group input-group"> <input class="<?=$val->getAttribute('class')?>" type="text" id="<?=$key?>" name="<?=$key?>" required="required" value="<?=$val->getValue()?>"> </div> <?php } elseif ($key == 'tpc_existing_module_name') { ?> <div class="form-group input-group"> <div class="col-md-2 padding-left-0"> <select id="<?=$key?>" name="<?=$key?>" required="required" class="<?=$val->getAttribute('class')?>"> <option value=""><?=$this->translate($existingModuleField->getOptions()['empty_option'])?></option> <?php if($existingModuleOptions){ foreach($existingModuleOptions as $module){ ?> <option value="<?=$module?>" <?=$existingModuleField->getValue() == $module ? "selected" : ""?>><?=$module?></option> <?php } } ?> </select> </div> </div> <?php } ?> </div> <?php }//end first foreach echo $this->form()->closeTag(); ?> </div>
info at phpclasses dot org