ソースを参照

intruduce custom form type to reference a form template

master
Dom SP 3年前
コミット
757bfd37a0
2個のファイルの変更27行の追加10行の削除
  1. +23
    -10
      app/modules/filesinfolders.php
  2. +4
    -0
      app/views/form.htm

+ 23
- 10
app/modules/filesinfolders.php ファイルの表示

@@ -145,15 +145,17 @@ class FilesInFolders {
? $this->config['includeTemplates']
: $f3->get('includeTemplates') ? : FALSE
;
foreach($this->structs[$domain_key]['tpl'] as $key=>$file) {
$str = \Template::instance()->render(substr($file,7));
$str = self::linkify($str);
$this->content[$domain][$key."00tpl"] = sprintf(
"<div class=\"item %s %s\">%s</div>",
$page,
$key,
$str
);
if ($includeTemplates) {
foreach($this->structs[$domain_key]['tpl'] as $key=>$file) {
$str = \Template::instance()->render(substr($file,7));
$str = self::linkify($str);
$this->content[$domain][$key."00tpl"] = sprintf(
"<div class=\"item %s %s\">%s</div>",
$page,
$key,
$str
);
}
}
$bulkIncludePic = array_key_exists('bulkIncludePic',$this->config)
? $this->config['bulkIncludePic']
@@ -412,9 +414,20 @@ class FilesInFolders {
$token = md5($timestamp . $form_config_file . rand(100,999));
$f3->config($form_config_file);
$fields = $f3->get('fields');
foreach ($fields as $k => $v) {
if ($v['type'] == 'custom') {
$fields[$k]['template'] = sprintf(
"%s%s",
substr($this->folder,8), //assumens content folder is content
$v['template']
);
}
}

$f3->set('fields',
array_merge(
$f3->get('fields'),
$fields,
['xss-token'=>[
'type'=>'hidden',
'value'=>$token,

+ 4
- 0
app/views/form.htm ファイルの表示

@@ -64,6 +64,10 @@
<br>
</true>
</check>

<check if="{{ @info.type == 'custom' }}">
<include href="{{ @info.template }}" with="elements={{ @info.el }},parent={{ @name }},options={{ @info.options }}" />
</check>
</repeat>
<button type="submit" >{{ @submit_text ? : 'save' }}</button>

読み込み中…
キャンセル
保存