[Solar-talk] config inheritance in helpers
Rodrigo Moraes
rodrigo.moraes at gmail.com
Thu Jul 27 04:06:25 PDT 2006
The idea behind the Pager Helper Family is to have a common set of
options for pager adapters and decorators, so you can change the pager
configuration and have a different amount of items in the list, a
different pager logic or different HTML markups without calling a
different helper. So the 'config' part is one of the most important
things (as in Solar ;-), and I tried to follow the same 'config
inheritance' Solar idea for the helpers. The current form is this:
$config = array(
'adapter' => 'Simple',
'options' => array('delta' => 5),
'decorator' => 'PagerList'
'display' => array('list_type' => 'ol', 'list_class' => 'pagination'),
);
'options' is related to the adapter 'Simple' and 'display' are the
options for the decorator 'PagerList'.
But I was lost. The decorator automatically merge its default $_config
with the user defined config ('display'), and then I just use $_config
inside it. But with the adapter this just didn't work, which made me
feel I was doing something wrong. So the working solution was to
create a property $_options for the adapter and merge the user defined
'options' with it.
Well, it works, but I would like to know a way to merge these config
parameters to make the configuration array as 'Solarized' as possible.
The pager set, I think, is part of a 'UI Widgets' library we have
talked about some time ago. I want to make other "helper sets" and it
would be important, starting from this one, to use a standard way to
tie them.
So, if you could take some time to review the pager helper set and
point what is wrong with the config part, or point flaws in the
interface, etc, it would help me a lot. Take your time, I'm not in a
hurry. It is working and I'm happy. But...
regards,
rodrigo moraes
More information about the solar-talk
mailing list