Reputation: 1281
I would like to extend the form.tpl of Prestashop (1.6.1.1). Therefor I created the following path in my module folder:
modules/mymodule/views/templates/admin/export/helpers/form/form.tpl
and
modules/mymodule/views/templates/admin/helpers/form/form.tpl
form.tpl
{extends file="helpers/form/form.tpl"}
{block name="input"}
{if $input.type == "test"}
<div class="form-group">
<input type="text" name="test" class="form-control" placeholder="Te">
</div>
{/if}
{/block}
AdminExportController.php
public function renderForm() {
$this->fields_form = array(
'legend' => array(
'title' => 'test'
),
'input' => array(
'type' => 'test'
)
);
return parent::renderForm();
}
But nothing shows up in my form :/ Any suggestions?
Upvotes: 1
Views: 2061
Reputation: 23
Try to locate here in ps 1.7.5.1:
/modules/YOUR_MODULE_NAME/views/templates/admin/_configure/helpers/form/form.tpl
Use this block name wth code:
{extends file="helpers/form/form.tpl"}
{block name="field"}
{if $input.type == "test"}
<div class="form-group">
<input type="text" name="test" class="form-control" placeholder="Te">
</div>
{/if}
{/block}
Upvotes: 2
Reputation: 146
Default you can place your form.tpl in the following folder: {module_dir}/views/templates/admin/{AdminController->tpl_folder}/helpers/form/form.tpl.
The value for {AdminController->tpl_folder} can be retrieved in the class AdminController.php:
// Get the name of the folder containing the custom tpl files
$this->tpl_folder = Tools::toUnderscoreCase(substr($this->controller_name, 5)).'/';
Upvotes: 2