Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Forms & Blueprints

Blueprints Element Field save Frontmatter

form

Solved by desta View solution

Started by desta 4 years ago · 5 replies · 581 views
4 years ago

Hi, I have blueprints

MARKDOWN
title: Landing
'@extends':
        type: default
form:
    fields:
        tabs:
            type: tabs
            active: 1
            fields:
                links:
                    type: tab
                    title: THEME_SAHABAT.ADMIN.LANDING.URL.LABEL
                    fields:
                        header.link:
                            name: link
                            type: list
                            style: vertical
                            label: THEME_SAHABAT.ADMIN.LANDING.URL.LABEL
                            fields:
                                .title:
                                    type: text
                                    label: THEME_SAHABAT.ADMIN.LANDING.TITLE.LABEL
                                    help: THEME_SAHABAT.ADMIN.LANDING.TITLE.HELP
                                .gambar:
                                    type: elements
                                    label: THEME_SAHABAT.ADMIN.LANDING.JENISGAMBAR.LABEL
                                    size: small
                                    default: imag
                                    options:
                                        ikon: Icon
                                        imag: Image
                                    fields:
                                        imag:
                                            type: element
                                            fields:
                                                .itemsimg:
                                                    type: filepicker
                                                    preview_images: true
                                                    label: THEME_SAHABAT.ADMIN.LANDING.GAMBAR.LABEL
                                                    help: THEME_SAHABAT.ADMIN.LANDING.GAMBAR.HELP
                                        ikon:
                                            type: element
                                            fields:
                                                .itemsico:
                                                    type: filepicker
                                                    acccept:
                                                        - .png
                                                    folder: 'theme@:/vendor/medicalicons/png'
                                                    preview_images: true
                                                    label: THEME_SAHABAT.ADMIN.ITEM_UNGGULAN.ICON_UNGGULAN.LABEL
                                                    help: THEME_SAHABAT.ADMIN.ITEM_UNGGULAN.ICON_UNGGULAN.HELP
                                .url:
                                    type: text
                                    label: THEME_SAHABAT.ADMIN.LANDING.URL.LABEL
                                    help: THEME_SAHABAT.ADMIN.LANDING.URL.HELP

but when i create a page, items element not saved

link:

YAML
-
    title: Beranda
    gambar: ikon
    url: beranda

-
    title: 'Layanan Unggulan'
    gambar: ikon
    url: layanan-unggulan

i have done read here -> https://learn.getgrav.org/17/forms/blueprints/fields-available#elements-field

can someone tell me, what' am i wrong?

Thanks before.

FYI: I just play gravcms last week ( until now 3 weeks ).

4 years ago

I think, i have answer closer,

YAML
title: Landing
'@extends':
        type: default
form:
    fields:
        tabs:
            type: tabs
            active: 1
            fields:
                links:
                    type: tab
                    title: THEME_SAHABAT.ADMIN.LANDING.URL.LABEL
                    fields:
                        header.link:
                            name: link
                            type: list
                            style: vertical
                            label: THEME_SAHABAT.ADMIN.LANDING.URL.LABEL
                            fields:
                                .title:
                                    type: text
                                    label: THEME_SAHABAT.ADMIN.LANDING.TITLE.LABEL
                                    help: THEME_SAHABAT.ADMIN.LANDING.TITLE.HELP
                                .detail.jenis:
                                    type: elements
                                    label: THEME_SAHABAT.ADMIN.LANDING.JENISGAMBAR.LABEL
                                    size: small
                                    default: imag
                                    options:
                                        ikon: Icon
                                        imag: Image
                                    fields:
                                        imag:
                                            type: element
                                            fields:
                                                .imag:
                                                    type: filepicker
                                                    preview_images: true
                                                    label: THEME_SAHABAT.ADMIN.LANDING.GAMBAR.LABEL
                                                    help: THEME_SAHABAT.ADMIN.LANDING.GAMBAR.HELP
                                        ikon:
                                            type: element
                                            fields:
                                                .ikon:
                                                    type: filepicker
                                                    acccept:
                                                        - .png
                                                    folder: 'theme@:/vendor/medicalicons/png'
                                                    preview_images: true
                                                    label: THEME_SAHABAT.ADMIN.ITEM_UNGGULAN.ICON_UNGGULAN.LABEL
                                                    help: THEME_SAHABAT.ADMIN.ITEM_UNGGULAN.ICON_UNGGULAN.HELP
                                .url:
                                    type: text
                                    label: THEME_SAHABAT.ADMIN.LANDING.URL.LABEL
                                    help: THEME_SAHABAT.ADMIN.LANDING.URL.HELP

output:

MARKDOWN
link:
    -
        title: Beranda
        detail:
            jenis: ikon
        url: /beranda

but i want output like this

MARKDOWN
link:
    -
        title: Beranda
        detail:
            jenis: ikon
            filename: home.png
        url: /beranda

i hope someone give me insight, i've deadlock to try.

Thanks b4.

4 years ago

Thanks sir.

I hope someone find- this bug, have you an idea sir?

4 years ago

@topidesta, You can subscribe to the Github issue I've created. You will then stay updated about the progress made by the dev team.

4 years ago Solution

Okay, i thinks it's bug has tracker in github by @pamtbaau , but my problem here is solved just add 2 field and if else in twig templating.

MARKDOWN
                                .imag:
                                    type: filepicker
                                    preview_images: true
                                    label: THEME_SAHABAT.ADMIN.LANDING.GAMBAR.LABEL
                                    help: THEME_SAHABAT.ADMIN.LANDING.GAMBAR.HELP
                                .ikon:
                                    type: filepicker
                                    acccept:
                                        - .png
                                    folder: 'theme@:/vendor/medicalicons/png'
                                    preview_images: true
                                    label: THEME_SAHABAT.ADMIN.ITEM_UNGGULAN.ICON_UNGGULAN.LABEL
                                    help: THEME_SAHABAT.ADMIN.ITEM_UNGGULAN.ICON_UNGGULAN.HELP

thanks @pamtbaau for your reply.

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Ton Haarmans, 5 years ago
13 1140 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 63 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 138 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 114 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 132 7 months ago