Closed plandolt closed 4 years ago
Thanks for contributing! Haven't we introduced wrappers already in https://github.com/terminal42/contao-node/issues/13? What's different here? :)
The implementation in #13 does the same but you need to do that everywhere you include nodes. This is not practicable when including a node on several pages where you need to have a wrapper with a consistent class. This PR implements a wrapper configuration on the node level to encapsulate the content elements within the node definition.
I see. Implementation-wise I would also like to have that template based, so that's one thing to adjust for sure. But conceptual-wise this sounds okay to me. Wdyt @qzminski?
I see your point. But I might need a little kickstart info to how I should implement a template based info.
I would also like to see an extra field in the wrapper
subpalette where you can select a partial frontend template (e.g. node_default.html5
) used to render that wrapper. So if wrapper
is enabled, the $buffer
in generateBuffer()
method should become:
if ($nodeModel->wrapper) {
$template = new FrontendTemplate($nodeModel->template);
$template->setData($nodeModel->row());
$template->buffer = $buffer;
$buffer = $template->parse(); // to be returned
}
voilà 😀
Look pretty okay to me, @Toflar ?
1.2.0 released, thank you @scuben !
I was in need to have a wrapper div on the node level containing all content elements within the node. This way I am able to define id/class to the node for styling. Then I can include this node anywhere and have it styled without any further configuration (like doing the wrapper when including the node). I hope you get the idea behind :)