dioscouri / f3-admin

3 stars 1 forks source link

Add a "MODULE" concept and manager #17

Closed rdiaztushman closed 10 years ago

rdiaztushman commented 10 years ago

it's kind of unavoidable. we need some kind of a "module" or "widget" or "plugin" or "block" concept in this f3-cms.

rdiaztushman commented 10 years ago

f3-blocks ?

ChrisFrench commented 10 years ago

I think modules is a good term, I also like blocks, I don't like plugins or widgets, to me widgets are for external sites.

I was thinking about this, since we are using mongo and since we have the route pattern in the hive already.

we could have a collection called modules.

if the module documents has an array in them of all the routes they should be applied too, we could do queries like this.

$this->filters['routes.path'] = $f3->get('PATTERN');

if we called the f3-blocks app in the "afterroute" function we could also disabled modules on pages easily in the entire app or enable them in an app easily.

public function afterRoute($f3){ \Blocks\Load::loadAll(); //maybe we could have an optional route you could pass to load blocks from another route.

}

which would give us an array of docs that need to be processed.

processing is complicated.

we could easily just do a Template instance, and render it into the hive and html, and in our views just echo them out by name.

or we could make them named to positions like joomla, and store them in an array like $f3->set('BLOCKS.topmenu', array());

This will need to get totally thought about before anyone starts it

On Fri, Dec 27, 2013 at 11:33 AM, Rafael Diaz-Tushman < notifications@github.com> wrote:

f3-blocks ?

— Reply to this email directly or view it on GitHubhttps://github.com/dioscouri/f3-admin/issues/17#issuecomment-31276572 .

rdiaztushman commented 10 years ago

I'll stick with either modules or blocks. I have a draft of this but it's not exactly functioning the way i'd like. we need to support at the very least: 1) assigning a module to routes 2) assigning a module to ALL routes 3) placing a module in particular positions in a template 4) publication rules (such as by date-range, ACL, login status, custom PHP, etc)

rdiaztushman commented 10 years ago

These modules/blocks are exclusively for DISPLAY, not for logical processing, so I don't think I'm going to put them in an afterRoute method. I like the idea of a static method like echo \Dsc\Blocks::load( $position, $route=null ); which can be used anywhere, and perhaps a method like: \Dsc\Blocks::registerPosition( $name ); to tell the f3-admin about the position so you can manage the modules from within the f3-admin menu manager

rdiaztushman commented 10 years ago

Modules need to be able to register system Listeners, so find some way to bootstrap them automagically. That's low priority, though, because you can always just manually add their listener in the index.php

rdiaztushman commented 10 years ago

There's also no reason why a single configured module cannot appear in multiple positions.

rdiaztushman commented 10 years ago

Fixed with https://github.com/dioscouri/f3-modules