Question about Plugin-priority

Hi there,

i noticed something i didn’t really understand.
I have two Pluginfolders in use: “kd-core-extension” and “kd-custom-extension”
The idea behind this is, that the core will contain generic stuff for the template which will be updated regularly and the custom is kind of a blank plugin, which will bring in adjustments specific for the customer i am designing for.

So in the core plugin i have a entry.php which is included perfectly.
If i create a entry.php in the custom plugin it should overide the file from the core. But for some reason this does not work. As soon as i rename the entry.php from the core-plugin. The entry.php form the custom kicks in.

From the alphabetical order “custom” should be loaded after “core” so i dont understand why this is not working.

greetings

Are those two entry.php files templates? And how did you register them? Please be a bit more specific.

Hi, those are snippets, which i include in the home.php template.

they are registered like that:

Kirby::plugin('khepri-design/core-extension', [
  'snippets' => [
    'includes/entry' => __DIR__ . '/snippets/includes/entry.php',

and called like that in the home.php

<?php snippet('includes/entry') ?>

The paths/syntax should be correct, because both snippets are working, just the entry.php from the custom-plugin is always prioritized.

Yes, that is to be expected (Kirby does an array_merge()), as the same snippet/template in a plugin that is loaded after the other, overwrites the first.

I thought that is what you wanted?

Typo from me here. I mean the entry.php in the core ist prioritized even though “custom” should bei loaded after because of the alphabetical Order.

I noticed, that it works with templates.
So home.php in custom overides home.php in core.
But the entry.php snippet is always taken from the core. As soon as i rename or delete it from core, the snippet from custom kicks in. :confused:

I tested your snippet example and it also works as expected. Make sure you are not using different keys.

What I don’t really understand is why you use a second plugin for the overwrites instead of simply putting the overwrite snippets into /site/snippets etc.

You are correct. Originally i thought it would be easier for me to handle in case of updating my template, if have all custom stuff in a single Plugin folder. But i know changed my structure, like you described and it should work super well also. Thanks^^