From 66d056d8ccf9613a65a4f56cfe96532d5c13b64b Mon Sep 17 00:00:00 2001 From: Aggiekev Date: Wed, 24 Jul 2024 21:05:02 -0500 Subject: [PATCH] Load Empty Presentation Allow for an empty base presentation to have slides added to it --- Presentation/Resource/Presentation.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Presentation/Resource/Presentation.php b/Presentation/Resource/Presentation.php index a6a52e1..bae98ca 100644 --- a/Presentation/Resource/Presentation.php +++ b/Presentation/Resource/Presentation.php @@ -26,7 +26,11 @@ public function addResource(ResourceInterface $resource): ?string $currentSlides = $this->content->xpath('p:sldIdLst/p:sldId'); $ref = $this->content->xpath('p:sldIdLst')[0]->addChild('sldId'); - $ref->addAttribute('id', (int)end($currentSlides)['id'] + 1); + if(count($currentSlides) > 0) + $ref->addAttribute('id', (int)end($currentSlides)['id'] + 1); + else + $ref->addAttribute('id', 1); + $ref->addAttribute('r:id', $rId, $this->namespaces['r']); return $rId;