PHP Classes

File: view/melis-templating-plugin-creator/templating-plugin-creator/partial/render-step1.phtml

Recommend this page to a friend!
  Classes of Fabrice Fesch   Melis Templating Plugin Creator   view/melis-templating-plugin-creator/templating-plugin-creator/partial/render-step1.phtml   Download  
File: view/melis-templating-plugin-creator/templating-plugin-creator/partial/render-step1.phtml
Role: Example script
Content type: text/plain
Description: Example script
Class: Melis Templating Plugin Creator
Create page template plugins for the Melis CMS
Author: By
Last change:
Date: 2 years ago
Size: 4,425 bytes
 

Contents

Class file image Download
<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>