xref: /plugin/dw2pdf/src/BookCreatorLiveSelectionCollector.php (revision 5340eaffbcc1177667ac835e4e719d9eb8959315)
12bef96e6SAndreas Gohr<?php
22bef96e6SAndreas Gohr
32bef96e6SAndreas Gohrnamespace dokuwiki\plugin\dw2pdf\src;
42bef96e6SAndreas Gohr
52bef96e6SAndreas Gohrclass BookCreatorLiveSelectionCollector extends AbstractCollector
62bef96e6SAndreas Gohr{
72bef96e6SAndreas Gohr    /**
82bef96e6SAndreas Gohr     * @inheritdoc
92bef96e6SAndreas Gohr     * @throws \JsonException
102bef96e6SAndreas Gohr     */
112bef96e6SAndreas Gohr    protected function collect(): array
122bef96e6SAndreas Gohr    {
13decfd8d6SAndreas Gohr        $selection = $this->getConfig()->getLiveSelection();
14decfd8d6SAndreas Gohr        if ($selection === null) return [];
15*32d393aeSAndreas Gohr        $list = (array)json_decode($selection, true, 512, JSON_THROW_ON_ERROR);
16*32d393aeSAndreas Gohr        return array_filter($list, fn($page) => page_exists($page));
172bef96e6SAndreas Gohr    }
182bef96e6SAndreas Gohr}
19