Created
April 6, 2016 15:36
-
-
Save bastianallgeier/38f895b32b71e8e2b2f3844e38df5489 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// register a field | |
$kirby->set('field', 'author', 'field/author'); | |
// register blueprints | |
$kirby->set('blueprint', 'blog', 'blueprints/blog.yml'); | |
$kirby->set('blueprint', 'article', 'blueprints/article.yml'); | |
// register a widget | |
$kirby->set('widget', 'visits', 'widgets/visits'); | |
// register templates | |
$kirby->set('template', 'blog', 'templates/blog.php'); | |
$kirby->set('template', 'article', 'templates/article.php'); | |
// register snippets | |
$kirby->set('snippet', 'pagination', 'snippets/pagination.php'); | |
// register controllers | |
$kirby->set('controller', 'blog', 'controllers/blog.php'); | |
$kirby->set('controller', 'article', 'controllers/blog.php'); | |
// register Kirbytags | |
$kirby->set('tag', 'article', [ | |
]); | |
// register page models | |
$kirby->set('page::model', 'blog', 'MyPlugin\\Models\\Blog'); | |
$kirby->set('page::model', 'article', 'MyPlugin\\Models\\Article'); | |
// register all kinds of hooks | |
$kirby->set('hook', 'panel.page.update', function() { | |
}); | |
// create page methods, pages methods, file methods and files methods | |
$kirby->set('page::method', 'comments', function() { | |
}); | |
// set options | |
$kirby->set('option', 'blog.title', 'My Blog'); | |
Is $kirby->set('controller', 'article', 'controllers/blog.php');
actually working?
With 2.3b2 in a plugin I had to give a full path to the controller file:
$kirby->set('controller', 'something', __DIR__ . DS . 'mycontroller.php');
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Setting routes as well: