As an introduction, I understand your willingness to kill unnecessary
divs, but I follow another approach.
As described in "The cathedral and the bazaar", Diem first objective
is to make things simpler for the user.
In some cases, efficiency may be sacrificed to simplicity. That's the
reason why many div wraps are used.
Additionally, as div tags are semantically null, there is no problem
in using lots of them. Some argue about performances and document
size. I don't have numbers but I'm certain the difference is just
imperceptible.
This is my personal opinion, and not the Diem one. Now, let's discuss
on how to kill these %$! divs.
> Actually, I don't think that the "width" is a useful option to have because I think that for complex projects, a CSS framework should be used (e.g. Blueprint or the like). And Blueprint works by adding classes, not applying width directly to the markup.
Yes. The zone "width" field has always been higly controversial. It
exists only to allow webmasters who know nothing about CSS to create
columns easily. For example they can set width to "50%" and get a two
columns area. But is letting people who know nothing about CSS modify
the site content a good idea ?
I prefer letting the site's developer answer to this question. That's
why I just added the zone_form service to the front service container.
By default the zone form uses the width field. But you can remove it
by changing the zone_form service class in your apps/front/config/dm/
services.yml:
parameters:
zone_form.class: myZoneFrontForm
Then, create apps/front/lib/myZoneFrontForm.php:
class myZoneFrontForm extends DmZoneFrontForm
{
public function configure()
{
parent::configure(); // let Diem configure the form
unset($this['width']); // remove this higly controversial field
}
}
I hope it makes you happier.
> > <div class="%widget_module% %widget_action%"> // widget : the widget's module and action are used as classes. This IS useful.
>
> Yes, I think that this is useful, but: it should probably be prefixed (!) by something even you don't use in your styles. The point being, that modules and actions are mostly pretty short and tend to have universal names. This could then easily crash your whole styles and you didn't even notice.
You're probably right. But what kind of prefix could be used ?
"module_" and "action_" ? The problem is that it will break BC, and
diem-project.org will explode. Help me cause I'm confused.
> > <div class="%user_classes%"> // widget inner : the user specified widget classes are applied here
>
> As I can imagine having widgets that don't wrap in divs (special paragraphs as widgets and so forth) I'd argue that this is not needed. If I create a widget that wraps, say, multiple paragraph widgets (is this possible?) I'd want to add this wrapper div *inside* the widget class to manage it more easily and if I don't want to wrap the widget content I don't have to. This is better managed inside the widget itself.
As for now, you cannot wrap widgets inside widgets. If we allow to do
so, it will become quite complex. Widgets are wrapped by zones, so you
have to insert multiple text widgets into your zone.
I'll sudy possibility to merge this div with the previous one. If we
do so, it has to apply both on view and edit mode. It will break BC.
We have to think about all compatibility breaks we may bring and
package all of them onto a Diem version. With a migration guide. Or a
BC configuration ( doesn't sound very good to me )
> And when you do implement this and you're not going far enough for me, I can easily extend your work and kill even more wrapper divs. :D
> But I do think that this is the right approach we're taking here, especially because it's still highly configurable and, if need be, customizable.
Yeah, everything needs to be customizable. This really is not a
problem. The real problem when creating a CMS is to provide sensible
defaults.