2016-04-14 90 views
1

我想將自定義字段「縮略圖」添加到靜態頁面插件的菜單表單中。如何將自定義字段添加到十月CMS靜態頁面插件?

我已經加入這一領域納入項目/插件/ rainlab /頁/班/菜單項/ fields.yaml

# =================================== 
# 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 

另外補充項目/插件/ rainlab /頁/班/ MenuItem.php

public $thumbnail; 

public $fillable = [ 
    'title', 
    'nesting', 
    'type', 
    'url', 
    'code', 
    'reference', 
    'cmsPage', 
    'replace', 
    'viewBag', 
    'thumbnail' // new field 
]; 

但它不起作用。如何解決這個問題呢?謝謝。

回答

0

對於簡單的類型的字段也需要改變JS文件

plugins/rainlab/pages/formwidgets/menuitems/assets/js/menu-items-editor.js 

在功能

MenuItemsEditor.prototype.applyMenuItem 

變化basicProperties

例如

basicProperties = { 
      'title': 1, 
      'type': 1, 
      'code': 1, 
      'thumbnail': 1 
     }, 

但文件不起作用。

相關問題