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

Extending sections or using mixins in plugin sections doesn't work as expected #6809

Open
tobimori opened this issue Nov 22, 2024 · 5 comments

Comments

@tobimori
Copy link
Contributor

tobimori commented Nov 22, 2024

Description

This is what I tried:

index.php

App::plugin('tobimori/test', ['sections' => ['submissions' => ['extends' => 'pages']]]);

Submissions.vue:

<script>
export default { extends: "k-pages-section" };
</script>

Result shows the empty pages section but clearly shows that no props are delivered (headline missing)
CleanShot 2024-11-22 at 16 12 52@2x

Let me know if you need anything else

Your setup

Kirby Version 4.4.1

@afbora
Copy link
Member

afbora commented Dec 6, 2024

Same issue was posted 1 year ago in forum https://forum.getkirby.com/t/how-to-extend-a-section/30517 but no replies.

@afbora
Copy link
Member

afbora commented Dec 6, 2024

@distantnative After long hours I found a clue for you. When I remove the load() method of the mixins, extending works. I think when extends is present, the load method of the mixins disables or overrides the ModelsSection::load() method.

I can take care the issue if solution is easy to implement. Currently I have no idea.

@distantnative
Copy link
Member

Ohhhhh, but great catch @afbora to find the source of this.

Maybe a workaround for now could be to not register the JS part as section but as component with k-THENAME-section. That should skip the mixing to be enforced which you wouldn't need when extending the modelssection anyway. Does that work?

For a real solution, maybe we need to consider not enforcing the section mixing but making it optional. Would be a breaking change for those plugins that then need to add it manually.

@afbora
Copy link
Member

afbora commented Dec 6, 2024

I couldn't figure out how to implement the workaround exactly. Also, doesn't k-models-section need to be defined to extend ModelsSection? As far as I can see, it isn't in https://github.com/getkirby/kirby/blob/4.5.0/panel/src/components/Sections/index.js

@distantnative
Copy link
Member

One would directly extend the models section of choice, e.g. in Tobi's case k-pages-section.

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

No branches or pull requests

3 participants