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

Provide a separator for cloned blocks #2443

Open
thomasb88 opened this issue Aug 26, 2023 · 0 comments
Open

Provide a separator for cloned blocks #2443

thomasb88 opened this issue Aug 26, 2023 · 0 comments

Comments

@thomasb88
Copy link

Is your feature request related to a problem? Please describe.

When cloning blocks using cloneBlock function in TemplateProcessor.php, add a parameter to separate the created blocks
(like page break, line break...)

Describe the solution you'd like

Replace

if ($replace) {
$this->tempDocumentMainPart = str_replace(
$matches[2] . $matches[3] . $matches[4],
implode('', $cloned),
$this->tempDocumentMainPart
);
}

by

if ($replace) {
$this->tempDocumentMainPart = str_replace(
$matches[2] . $matches[3] . $matches[4],
implode($xml_separator, $cloned),
$this->tempDocumentMainPart
);
}

Where $xml_separator is built from a parameter, like (old school xml building)

switch($separator){
case "pagebreak":
$xml_separator = $this->xml_pagebreak('page');
break;
case "linebreak":
$xml_separator = $this->xml_linebreak();
break;
default:
$xml_separator = '';
break;
}

Describe alternatives you've considered

Add it directly in the template, but if added at the end of the template, then the last one is not wanted, or if added at the beginning, then the first one is not wanted.

Additional context

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

No branches or pull requests

1 participant