Php 如何将自定义字段添加到静态页面插件中?
我想在静态页面插件的菜单表单中添加自定义字段“缩略图” 我已经将此字段添加到project/plugins/rainlab/pages/classes/menuitem/fields.yaml中Php 如何将自定义字段添加到静态页面插件中?,php,laravel-5,laravel-5.1,octobercms,Php,Laravel 5,Laravel 5.1,Octobercms,我想在静态页面插件的菜单表单中添加自定义字段“缩略图” 我已经将此字段添加到project/plugins/rainlab/pages/classes/menuitem/fields.yaml中 # =================================== # Field Definitions # =================================== fields: title: span: left label:
# ===================================
# Field Definitions
# ===================================
fields:
title:
span: left
label: rainlab.pages::lang.menuitem.title
type:
span: right
label: rainlab.pages::lang.menuitem.type
type: dropdown
url:
label: rainlab.pages::lang.menuitem.url
reference:
label: rainlab.pages::lang.menuitem.reference
type: dropdown
cssClass: input-sidebar-control
thumbnail:
label: Thumbnail
mode: file
cssClass: input-sidebar-control
type: mediafinder
// another part of code is default
另外还有附加项目/plugins/rainlab/pages/classes/MenuItem.php
public $thumbnail;
public $fillable = [
'title',
'nesting',
'type',
'url',
'code',
'reference',
'cmsPage',
'replace',
'viewBag',
'thumbnail' // new field
];
但它不起作用。如何解决这个问题?谢谢。对于简单类型的字段,还需要更改js文件
plugins/rainlab/pages/formwidgets/menuitems/assets/js/menu-items-editor.js
在功能上
MenuItemsEditor.prototype.applyMenuItem
更改基本属性
范例
basicProperties = {
'title': 1,
'type': 1,
'code': 1,
'thumbnail': 1
},
但对于文件,它不起作用。对于简单类型的字段,也需要更改js文件
plugins/rainlab/pages/formwidgets/menuitems/assets/js/menu-items-editor.js
在功能上
MenuItemsEditor.prototype.applyMenuItem
更改基本属性
范例
basicProperties = {
'title': 1,
'type': 1,
'code': 1,
'thumbnail': 1
},
但是对于文件,它不起作用。我认为你必须扩展插件,文档中的更多信息:我认为你必须扩展插件,文档中的更多信息: