jeyroik/JeyRoik — pull request #17 by Sett (2014-04-08 20:30:41+00:00)
Title: Plugin system and correct Controllers path

1. It is not wright that Controllers are placed in /modules/Controller, because they are not modules - they are part of an application. So I suggest to put them into /application/Controller.

2. It looks like a crutch to add name of one trait to it sub-traits. Sub traits must be operated in the same way as root traits. And there was one more crutch - "out traits". It is so ugly, that a can not stand it anymore.

So I suggest plugin system.
It is very simple:

We add "plugins" section to the "traits" block. Each item should be like

"path_to_the_plugin" => "some additional data for this plugin"

In the path_to_the_plugin must be an anonymous function, which get 2 parameters:
1. Config - the whole "traits" block.
2. Plugin data - see the example below.

Plugin must return a config.
Look /library/Jeyroik/Plugins/prefix.php to understand what I'm talking about.

By the way, plugins are storing around a request, so if you use the same plugin several times, it will be loaded only once.

In this way adding prefix (as name before) looks like feature - not like a crutch (:

I think plugin system give a great power to manipulate compile configuration. May be should apply it to the onLoad config too?