Skip to content

设置功能

主题模板设置文件,负责定义主题模板自己的配置项。

模板文件介绍
functions.blade.php主题功能视图模板

变量

变量名介绍
$params来自 theme.json 配置文件 functionItems
$fileUrls$params 里文件类型配置项,处理成 URL 值
$lang来自 theme.json 配置文件 functionLang
$apps来自已安装的应用列表(插件、应用)
$languageStatus系统语言开启状态 language_status
$languageMenus系统语言菜单列表 language_menus
$defaultLanguage系统默认语言标签 default_language

接口

请求方式接口路径路由名介绍
PUT/api/theme/{fskey}/functionsfresns.api.functions更新 Config Item 配置值
  • 传参方式: multipart/form-data
  • 提交方式: ajax 或者 form submit
php
route('fresns.api.functions', [
    'fskey' => '' // theme fskey
])

表单

html
<form action="{{ route('fresns.api.functions', ['fskey' => 'ThemeFrame']) }}" method="post" enctype="multipart/form-data">
    @csrf
    @method('put')

    <!-- input: item_key=fs_theme_name -->
    <input type="text" name="fs_theme_name" value="{{ $params['fs_theme_name'] }}">

    <!-- textarea: item_key=fs_theme_intro -->
    <textarea name="fs_theme_intro">{{ $params['fs_theme_intro'] }}</textarea>

    <!-- input file: item_key=fs_theme_logo -->
    <input type="file" name="fs_theme_logo" value="{{ $params['fs_theme_logo'] }}">
    <!-- or -->
    <input type="url" name="fs_theme_logo" value="{{ $params['fs_theme_logo'] }}">

    <!-- select: item_key=fs_theme_type -->
    <select name="fs_theme_type">
        <option value="" {{ $params['fs_theme_type'] == '' ? 'selected' : '' }}>Null</option>
        <option value="1" {{ $params['fs_theme_type'] == '1' ? 'selected' : '' }}>One</option>
        <option value="2" {{ $params['fs_theme_type'] == '2' ? 'selected' : '' }}>Two</option>
    </select>

    <!-- select multiple: item_key=fs_theme_types -->
    <select name="fs_theme_types" multiple>
        <option value="" {{ $params['fs_theme_type'] == '' ? 'selected' : '' }}>Null</option>
        <option value="1" {{ $params['fs_theme_type'] == '' ? 'selected' : '' }}>One</option>
        <option value="2" {{ $params['fs_theme_type'] == '' ? 'selected' : '' }}>Two</option>
    </select>

    <!-- plugin select multiple: item_key=fs_theme_plugins -->
    @foreach($params['fs_theme_plugins'] as $plugin)
        <input type="text" name="fs_theme_plugins[code][]" value="{{ $plugin['code'] }}">

        <input type="text" name="fs_theme_plugins[name][]" value="{{ json_encode($plugin['name']) }}">

        <select name="fs_theme_plugins[fskey][]">
            @foreach($apps as $app)
                <option value="{{ $app->fskey }}" {{ $app->fskey == $plugin['fskey'] ? 'selected' : '' }}>{{ $app->name }}</option>
            @endforeach
        </select>

        <input type="number" name="fs_theme_plugins[order][]">
    @endforeach

    <button type="submit">Save</button>
</form>

视图框架

blade
@extends('ThemeFunctions::layout')

@section('body')
    {{-- form --}}
@endsection

@push('style')
    {{-- css --}}
@endpush

@push('script')
    {{-- js --}}
@endpush

Released under the Apache-2.0 License