Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bertoost opened this issue Jun 12, 2024 · 0 comments

Comments

@bertoost
Copy link

bertoost commented Jun 12, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant