# tableberg/1.0.4/renderer/Text/TextRenderer.php

Tableberg – Simple Gutenberg Table Block, version 1.0.4. 39 lines.

- Page: https://pluginprobe.com/plugins/tableberg/1.0.4/code/renderer/Text/TextRenderer.php
- Raw: https://pluginprobe.com/plugins/tableberg/1.0.4/raw/renderer/Text/TextRenderer.php
- Modified: 2026-05-04T16:51:12+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/tableberg/1.0.4/code/renderer/Text/TextRenderer.php#L10-L20`.

```php
<?php

namespace Tableberg\Renderer\Text;

class TextRenderer {
    /**
     * @param array<string, mixed>|null $attributes
     * @return string
     */
    public function render($attributes) {
        $attrs = TextAttrs::from_array($attributes);

        $styleValues = ['margin:0'];

        if ($attrs->styles->textColor->isNotEmpty()) {
            $styleValues[] = 'color:' . $attrs->styles->textColor->asAttr();
        }

        if ($attrs->styles->linkColor->isNotEmpty()) {
            $styleValues[] = '--tableberg-text-link-color:' . $attrs->styles->linkColor->asAttr();
        }

        if ($attrs->styles->backgroundColor->isNotEmpty()) {
            $styleValues[] = 'background-color:' . $attrs->styles->backgroundColor->asAttr();
        }

        if ($attrs->styles->fontSize->isNotEmpty()) {
            $styleValues[] = 'font-size:' . $attrs->styles->fontSize->asAttr();
        }

        $styleAttr = implode(';', $styleValues);

        return
            "<p class='tableberg-text-element' style='{$styleAttr}'>
                {$attrs->content->asHtml()}
            </p>";
    }
}

```
