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

BUG Tweak URL generation so blocks can be edited when added to an Area on a regular DO #873

Draft
wants to merge 1 commit into
base: 4
Choose a base branch
from

Conversation

maxime-rainville
Copy link
Contributor

This is a WIP. Not ready for peer review.

Parent issue

@maxime-rainville
Copy link
Contributor Author

A dev would need to add this code snippet to their DO for this PR to work.

    /**
     * Sanitise a model class' name for inclusion in a link
     *
     * @param string $class
     * @return string
     */
    protected function sanitiseClassName($class)
    {
        return str_replace('\\', '-', $class);
    }

    public function CMSEditLink()
    {
        return Controller::join_links(
            TestModelAdmin::singleton()->Link($this->sanitiseClassName(self::class)),
            'EditForm/field',
            $this->sanitiseClassName(self::class),
            'item',
            $this->ID,
            'edit'
        );
    }

    public function Link() {
        return 'frontend-link';
    }

@maxime-rainville maxime-rainville changed the title BUG Tweak URL generation so blocks can be edited whon added to an Area on a regular DO BUG Tweak URL generation so blocks can be edited when added to an Area on a regular DO Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Elemental Area can't easily be added to a non-Page DataObject and edited in a ModelAdmin
1 participant