Skip to content

Commit

Permalink
Don't copy the object, just the styles for placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Peters committed Jun 7, 2024
1 parent 290e208 commit 96e784b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/PhpPresentation/Slide.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,20 @@ public function setSlideLayout(SlideLayout $layout): self
//Loop through the layout and copy any shapes that are placeholders on to this slide
foreach ($layout->getShapeCollection() as $shape) {
if ($shape->isPlaceholder()) {
$this->addShape(clone $shape);
$s = clone $shape;
//If it is a RichText
if ($s instanceof \PhpOffice\PhpPresentation\Shape\RichText) {
//Clone the paragraphs
$paras = $s->getParagraphs();
$para_clones = [];
//Loop through and copy the paragraphs
foreach ($paras as $para) {
$newPara = clone $para;
$para_clones[] = $newPara;
}
$s->setParagraphs($para_clones);
}
$this->addShape($s);
}
}

Expand Down

0 comments on commit 96e784b

Please sign in to comment.