AugustMiller / kirby-architect

šŸ“ Easily reference Blueprint data from anywhere in your Kirby application.
38 stars 1 forks source link

page method #4

Closed jenstornell closed 8 years ago

jenstornell commented 8 years ago

Something like this:

echo $page->architect($args);

The benefit is that this page contains an intended template and the page blueprint can be used.

AugustMiller commented 8 years ago

I think I'm going to add the following to the Readme, rather than including it in the repository itself:

kirby()->set('page::method', 'architect', function($page) {
  return Architect::blueprint($page->intendedTemplate());
});

This way, developers can add the functionality easily, without the method name colliding with any of their fields.

One major caveat: I opened a thread about the trouble I had making page method extensions within config.php. Whoever is implementing the plugin has to drop these into a new plugin file, not their config fileā€¦

jenstornell commented 8 years ago

Go for a plugin approach. At least I would. Maybe even make an example plugin with all the available field and page methods.

AugustMiller commented 8 years ago

Implemented in the readme in f0bebd2de5d91ab358992f67591e71badcbf5a35.