Closed wilsonge closed 9 years ago
I agree. But that would be for form fields. For plugins (for example) that wouldn't be needed as we just have one view. people aren't gonna be overriding the inputs
Don't you extend JPlugin class in your own plugins?
This would allow you to:
If I'm right most plugins will only have the getLayoutData method. So you can override the renderer in a base plugin class and use the same renderer in all your plugins for example. On 3 Sep 2014 23:16, "George Wilson" notifications@github.com wrote:
I agree. But that would be for form fields. For plugins (for example) that wouldn't be needed as we just have one view. people aren't gonna be overriding the inputs
— Reply to this email directly or view it on GitHub https://github.com/joomla-projects/cms-naked/pull/60#issuecomment-54368684 .
OK so your saying that you have a common plugin class
commonPlugin extends JPlugin
{
abstract public function getLayoutData
public function getRenderer($path)
{
new JLayoutFile($path);
}
}
and a specific plugin from there with just the getLayoutData function in?
Myrealplugin extends commonPlugin
{
// plugin code here with overrides as necessary.
}
I'm better explaining things with code :octocat:
New PR with quickicons cleanup https://github.com/wilsonge/cms-naked/pull/2
After that I think we have to merge this to start using the renderer on the other sections (fields, libraries, modules, etc.).
One of the things I found useful while working with this is to create a different function to get the layout data. This is better because:
Example for base field:
Example override in child field:
Another good example is the current
view.html.php
files where the display method contains everything. If we use thegetLayoutData()
function most views will only change that function which simplifies everything a lot.