sammarks / ablecore

A library for Drupal developers.
MIT License
5 stars 4 forks source link

Create better way to generate render arrays. #49

Open sammarks opened 9 years ago

sammarks commented 9 years ago

If you have to create a Drupal render array, it takes quite a bit of code to come up with one that generates a lot of HTML markup. Therefore, we should introduce some kind of XML markup like the following:

<container class="attorney-hero">
    <theme theme="image" path="$ac_node->field_image" alt="$ac_node->title" />
    <container key="details" class="attorney-details">
        <container key="header" class="hero-header">
            <html_tag tag="h1">$formatted_name</html_tag>
        </container>
    </container>
</container>

The idea is that you write the XML, place it in a file, the render array is generated in the theme function, modules are allowed to modify this render array to their pleasing and then the final render array is passed through drupal_render resulting in the final HTML.

This goes in conjunction with #50.