Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elemental support #116

Closed
emteknetnz opened this issue Nov 2, 2023 · 1 comment
Closed

Elemental support #116

emteknetnz opened this issue Nov 2, 2023 · 1 comment

Comments

@emteknetnz
Copy link
Member

emteknetnz commented Nov 2, 2023

Assumes that the PR to use FormSchema for submissions has been merged

Linkfields do not work in elemental inline edit blocks. Part of this reason may be the underlying HTML for the inline edit form is different than for a Page edit form, e.g.

Page edit form:
image

Elemental inline edit:
image

Note that it don't think this works either with the existing stable version of linkfield either, I wasn't able to inline edit them either, though perhaps I was doing something wrong. I used the following code for my block:

<?php

use DNADesign\Elemental\Models\BaseElement;
use SilverStripe\LinkField\Form\LinkField;
use SilverStripe\LinkField\Models\Link;

class AnotherBlock extends BaseElement
{
    private static $db = [
        'MyField' => 'Varchar',
    ];

    private static $has_one = [
        'MyLink' => Link::class,
    ];

    private static $table_name = 'AnotherBlock';

    private static $singular_name = 'Another Block';

    private static $plural_name = 'Another Blocks';

    private static $description = 'This is another block';

    private static $icon = 'font-icon-block-content';

    public function getType()
    {
        return 'Another Block';
    }

    public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $fields->insertAfter('MyField', new LinkField('MyLink'));
        return $fields;
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants