ElkArte Community

Elk Development => Feature Discussion => Exterminated Features => Topic started by: TE on April 02, 2013, 03:17:44 pm

Title: interface action_controller?
Post by: TE on April 02, 2013, 03:17:44 pm
It's not that useful for now, but my heart says: let's use an interface for the admin controllers.. All controllers need at least the action_index() method, IMO this should be declared in an interface.

Code: [Select]
interface admin_action_controller
{
     function action_index();
     function settings(); // deprecated, I know..
}

and in the related controller:
Code: [Select]
class ManageBBC_Controller implements admin_action_controller
{
/**
* BBC settings form
* @var Settings_Form
*/
...

It's just a quick'n'dirty sample..

Opinions?
Title: Re: interface action_controller?
Post by: TestMonkey on April 02, 2013, 04:48:11 pm
Quote from: TE – It's not that useful for now, but my heart says: let's use an interface for the admin controllers.. All controllers need at least the action_index() method, IMO this should be declared in an interface.

Surely. :) Or an abstract base class.

Also, I believe pre_dispatch() (https://github.com/elkarte/Elkarte/blob/master/sources/Dispatcher.class.php#L301) is part of it.
Thinking at contextual stuff they do, such as load templates and languages.

There's no particular certain reason for a base class vs an interface. But it can always be filled with a method they need.
Title: Re: interface action_controller?
Post by: emanuele on October 04, 2013, 05:12:24 am
I think we have this now...am I wrong?
Title: Re: interface action_controller?
Post by: TE on October 04, 2013, 05:20:07 am
yep, we have.. not an interface but an abstract class but we have .. :)
Title: Re: interface action_controller?
Post by: emanuele on October 04, 2013, 05:24:47 am
Then...

/me moves it because TE is too lazy. :P