jeudi 14 avril 2016

How to add custom fields into October CMS static pages plugin?

I want to add custom field "thumbnail" into menu form in static pages plugin.

I already add this field into project/plugins/rainlab/pages/classes/menuitem/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

Also add in project/plugins/rainlab/pages/classes/MenuItem.php

public $thumbnail;

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

But it doesn't works. How to solve this problem? Thank you.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire