stonelab/dynamicfield

There is no license information available for the latest version (0.8.7) of this package.

Installs: 59

Dependents: 0

Suggesters: 0

Security: 0

Stars: 8

Watchers: 5

Forks: 6

Open Issues: 3

Type:asgard-module

0.8.7 2017-04-18 13:43 UTC

This package is not auto-updated.

Last update: 2024-11-09 19:04:39 UTC


README

This module is working, but in a very alpha version. Using is at your own risk! You are welcome to work on it

Introduction

Please add following to asgard.page.config.php:

<?php

return [
    /*
    |--------------------------------------------------------------------------
    | Partials to include on page views
    |--------------------------------------------------------------------------
    | List the partials you wish to include on the different type page views
    | The content of those fields well be caught by the PageWasCreated and PageWasEdited events
    */
    'partials' => [
        'translatable' => [
            'create' => [
                'dynamicfield::admin.dynamicfield.entity-type.page-fields'
            ],
            'edit' => [
                'dynamicfield::admin.dynamicfield.entity-type.page-fields'
            ],
        ],
        'normal' => [
            'create' => ['dynamicfield::admin.dynamicfield.entity-type.page-script'],
            'edit' => ['dynamicfield::admin.dynamicfield.entity-type.page-script'],
        ],
    ],
    /*
    |--------------------------------------------------------------------------
    | Dynamic relations
    |--------------------------------------------------------------------------
    | Add relations that will be dynamically added to the Page entity
    */
    'relations' => [
//        'extension' => function ($self) {
//            return $self->belongsTo(PageExtension::class, 'id', 'page_id')->first();
//        }
    ],
];

Usage

Creat a new Dynamicfield and select on the right side on which page template you wanna use it.

After you've created your first Dynamicfield, you can go to the Page create/edit view, select your desired Template and then, the Dynamicfield should appear automatically.

If nothing happens, make sure the dynamic-fields.js is loaded. Clear Cache and run the "module:publish dynamicfield" command

After you have created your Dynamicfield, set up your page and filled your data, your able to get the datas on your page template through the:

$dynamicfields

It's an array and inside are all fields, as well the repeater fields. the name of the indexes are the same which you have given for the field name.