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

Extend "Plugin best practices" doc with thoughts on easy extendability #1009

Open
sebastiangreger opened this issue Aug 12, 2020 · 1 comment
Labels
type: content 📝 Is content-related

Comments

@sebastiangreger
Copy link
Contributor

Not sure is this an "idea" issue, or should it be a issue (or PR) in the getkirby.com repo?

When writing a plugin with snippets, these can be overridden by a site using a snippet of the same name as registered. In order to allow developers to keep their snippets folder clean, it would be good practice to not register them with

'snippets'     => [
    'pluginname_snippetname' => __DIR__ . '/snippets/snippetname.php',
]

but

'snippets'     => [
    'pluginname/snippetname' => __DIR__ . '/snippets/snippetname.php',
]

instead. This allows to place plugin-related custom snippets into folder site/snippets/pluginname rather than adding them to the main site/snippets folder. I got feedback on that related to one of my plugins, and today - now sensitized to it - encountered the same while implementing somebody else's plugin.

A recommendation to use the latter style in the "Best practices" document could help establish this as a pattern? Maybe as a subchapter along with some other "best practices" that make it easy to override plugin defaults for site authors?

@lukasbestle lukasbestle transferred this issue from getkirby/ideas Aug 13, 2020
@lukasbestle
Copy link
Member

Good point, I fully agree that this is a best-practice worth sharing. 👍

I have moved the issue to the getkirby.com repo.

@distantnative distantnative added the type: content 📝 Is content-related label Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: content 📝 Is content-related
Projects
None yet
Development

No branches or pull requests

3 participants