• Resolved quelltexterin

    (@quelltexterin)


    Hi, in my current project I work with Advanced Gutenberg and Timber for serverside Rendering of blocks. For “Advanced Table” I would like to use my custom template to render a table, but the table is fully rendered in $content.

    Will there be a possibility to return all table data as array or object, so I have more power over my table. Especially for responsive behaviour it would be great, If I could add classes or other html-tags.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    As blocks are plain html, that’s what Gutenberg expects, you can’t have anything else returned than an html string.

    But you can still parse the html rendered with a DOM parser.
    You can use the built in php methods https://php.net/manual/en/domdocument.loadhtml.php
    Or use a helper class to manipulare the html, here is an example https://stackoverflow.com/questions/23522784/simple-html-dom-parser-table-to-array#answer-25351365

    Hope it helps.

    Thread Starter quelltexterin

    (@quelltexterin)

    Thanks for your answer, but thats not totally right.

    For example your accordion is an array attribute, where I can loop and have directly access to header and content.

    Well, I have to admit, I don’t know Timber.
    And it seems that our block attributes are parsed and you can access it your script.
    These attributes are not generated to be accessed from the theme though, it’s used to generate our block in the Gutenberg editor via our own script.
    Because of that this may not be completely reliable and may be subject to changes in the next releases.

    We don’t use attributes for the table and it’s not planned to be yet, but I completely get the idea and benefits you have using it for your custom theme.
    But that’s not a complete no, I do get the point and we will discuss about that.

    Also, would you provide an extract of the code you use to retrieve this attributes in your theme?

    Best regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Enhancement Advanced Table Rendering’ is closed to new replies.