Skip to content

[Feature Request] Added ability to overwrite the wrapping adf-container html tag #10

@bertoost

Description

@bertoost

Hi,

Currently in the DocumentExporter, there is a fixed definition of the tags where to wrap the exported html in.

DH\Adf\Exporter\Html\Block\DocumentExporter

It would be nice to make it possible to overwrite the wrapping tag, something like;

$output = (new DocumentExporter($doc))
    ->wrapTags('<div class="container"><div class="row">', '</div></div>')
    ->export();

The code to extend the DocumentExporter with

public function wrapTags(?string $opening = null, ?string $closing = null): self
{
    if (
        (null !== $opening && null === $closing)
        || (null === $opening && null !== $closing)
    ) {
        throw new RuntimeException('Passing both opening and closing tag.');
    }

    if (null === $opening && null === $closing) {
        $this->tags = [];

        return $this;
    }

    $this->tags = [$opening, $closing];

    return $this;
}

With this it is possible to set it to nothing, to not wrap it in tags.

Regards, Bert

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions