Tarjei Huse | 29 Oct 15:35
Picon
Favicon
Gravatar

suggested new style speck


Style spesification

Stylestack
All styles are registred in a stylestack that is searched for elements.
The stylestack describes where midgard will go first to find an element.

Default stylestack.

The basic stylestack follows the way it is done today:
Let's say we got the style base_midcom and a substyle nemein.Also we're
requesting the page test.

The the stylestack would start out like this:

1. test
2. nemein
3. midcom_base

then midcom starts and decides which module it want's to use. The module
is appended to the stylestack:

MidgardStyle::prepend_style('file://de/linkm/taviewer/style');
print_r(MidgardStyle::get_stack()); 
outputs:
array (
 [0] => page://test,
 [1] => midcom_base/nemein,
 [2] => midcom_base
 [3] => 'file://de/linkm/taviewer/style'
)

Then the module does a dynamic load with the new dyn_load object API:

$dl = new Midcom_helper_dynamic_load();
$dl->set_style('calendar');
$dl->show();

within show() the following happens:
MidgardStyle::append_style('calendar');
print_r(MidgardStyle::get_stack()); 
outputs:
array (
 [0] => page://test,
 [1] => calendar,
 [2] => midcom_base/nemein,
 [3] => midcom_base
 [4] => 'file://de/linkm/taviewer/style'
)
// note: the pagestyle still overrides the midcom style in this example.
I'm not sure if that is a good idea.

mgd_show_style_element('hour_view');
MidgardStyle::pop(); 
return;

then after dynamic_load returns, we got:
print_r(MidgardStyle::get_stack()); 
outputs:
array (
 [0] => page://test,
 [1] => midcom_base/nemein,
 [2] => midcom_base
 [3] => 'file://de/linkm/taviewer/style'
)

Which is the same as before.

Usage of a MidcomStyle is not important for me, we could have
mgd_append_style() instead.

Tarjei
--

-- 
Tarjei Huse <tarjei@...>

Gmane