提交 fcef7f07 编写于 作者: D Devil

动态列表数据格子支持钩子

上级 40ddae0d
......@@ -394,6 +394,8 @@ class Common extends BaseController
}
}
// 表格列表公共标识
MyViewAssign('hook_name_form_list', $current.'_list');
// 内容外部顶部
MyViewAssign('hook_name_content_top', $current.'_content_top');
// 内容外部底部
......
......@@ -298,6 +298,33 @@
{{/if}}
{{/case}}
{{/switch}}
<!-- 列表格子钩子 -->
{{if !empty($t['unique_key']) and $t['view_type'] neq 'operate'}}
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
<div class="plugins-tag">
<span>{{$hook_name_form_list}}_grid_{{$t.unique_key}}</span>
</div>
{{/if}}
{{php}}
$hook_data = MyEventTrigger($hook_name_form_list.'_grid_'.$t['unique_key'], [
'hook_name' => $hook_name_form_list.'_grid_'.$t['unique_key'],
'is_backend' => true,
'id' => isset($data_list[$i][$form_table['base']['key_field']]) ? $data_list[$i][$form_table['base']['key_field']] : 0,
'data' => $data_list[$i],
]);
if(!empty($hook_data) && is_array($hook_data))
{
foreach($hook_data as $hook)
{
if(is_string($hook) || is_int($hook))
{
echo htmlspecialchars_decode($hook);
}
}
}
{{/php}}
{{/if}}
{{/if}}
</td>
{{/if}}
......
......@@ -554,6 +554,8 @@ class Common extends BaseController
}
}
// 表格列表公共标识
MyViewAssign('hook_name_form_list', $current.'_list');
// 内容外部顶部
MyViewAssign('hook_name_content_top', $current.'_content_top');
// 内容外部底部
......
......@@ -298,6 +298,33 @@
{{/if}}
{{/case}}
{{/switch}}
<!-- 列表格子钩子 -->
{{if !empty($t['unique_key']) and $t['view_type'] neq 'operate'}}
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
<div class="plugins-tag">
<span>{{$hook_name_form_list}}_grid_{{$t.unique_key}}</span>
</div>
{{/if}}
{{php}}
$hook_data = MyEventTrigger($hook_name_form_list.'_grid_'.$t['unique_key'], [
'hook_name' => $hook_name_form_list.'_grid_'.$t['unique_key'],
'is_backend' => true,
'id' => isset($data_list[$i][$form_table['base']['key_field']]) ? $data_list[$i][$form_table['base']['key_field']] : 0,
'data' => $data_list[$i],
]);
if(!empty($hook_data) && is_array($hook_data))
{
foreach($hook_data as $hook)
{
if(is_string($hook) || is_int($hook))
{
echo htmlspecialchars_decode($hook);
}
}
}
{{/php}}
{{/if}}
{{/if}}
</td>
{{/if}}
......
......@@ -620,6 +620,22 @@ class FormHandleModule
{
$this->order_by['field'] = empty($v['sort_field']) ? $form_name : $v['sort_field'];
}
// 唯一key,避免是模块路径、直接取最后一段
$unique_key = '';
if(!empty($v['view_key']))
{
// 多字段情况下
if(is_array($v['view_key']))
{
$unique_key = isset($v['view_key'][0]) ? $v['view_key'][0] : '';
} else {
// 字段名称、模块路径
$temp = explode('/', $v['view_key']);
$unique_key = empty($temp) ? '' : end($temp);
}
}
$v['unique_key'] = $unique_key;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册