Override element

By default, the “Express Form Templating” custom block template will use a blade element. This is located under:

  • packages/express_form_templating/elements/express/form/form/express_form_templating/default.blade.php

You are able to override this file. Copy paste it to this location for example:

  • application/elements/express/form/form/express_form_templating/default.blade.php

After doing so, any changes in the application folder will apply to each block with this template. I did a small customization for all forms that needed an icon in front of the input field. Like an “@” or a “user icon”. See the image below:

You want to do the same? Look for “{{-- Controls/inputs --}}” in this file. Remove the whole “@foreach” (ends with “@foreach”). Replace it with the code below (and adjust for your purpose):


@foreach ($fieldSet->controls as $controlHandle => $control) 
     <?php 
$key = strtolower(explode('_', $controlHandle)[0]);
switch($key){
case 'email':
case 'name':
case 'phone': case 'url':
$inputGroupAddon = null;
switch ($key) {
case 'email':
$inputGroupAddon = '@';
break;
case 'name':
$inputGroupAddon = '<i class="fa fa-user"></i>';
break;
case 'phone':
$inputGroupAddon = '<i class="fa fa-phone"></i>';
break;
case 'url':
$inputGroupAddon = '<i class="fa fa-link"></i>';
break;
} ?>

<div class="{{ $controlClass }}">
@if ($controlLabelDisplay)
{{-- Label --}}
<label for="{{ $control->labelFor }}" class="{{ $controlLabelClass }}">
{{ $control->labelText }}@if ($control->required){!! $requiredHtmlElement !!}@endif
</label>
@endif

@if($inputGroupAddon)
<div class="input-group">
<span class="input-group-addon"><?php echo $inputGroupAddon; ?></span>
{{-- The input --}}
{!! $control->input !!}
</div>
@else
<div class="{{ $controlClass }}">
@if ($controlLabelDisplay) {{-- Label --}}
<label for="{{ $control->labelFor }}" class="{{ $controlLabelClass }}">
{{ $control->labelText }}@if ($control->required){!! $requiredHtmlElement !!}@endif </label>
@endif

{{-- The input --}}
{!! $control->input !!}
</div>
@endif
</div>
<?php
break;
default: ?>

<div class="{{ $controlClass }}">
@if ($controlLabelDisplay)
{{-- Label --}}
<label for="{{ $control->labelFor }}" class="{{ $controlLabelClass }}">
{{ $control->labelText }}@if ($control->required){!! $requiredHtmlElement !!}@endif
</label>
@endif

{{-- The input --}}
{!! $control->input !!}
</div>
<?php
break;
} ?>
@endforeach