parse($text); return $this->_chapters; } /** * @inheritdoc */ protected function renderHeadline($block) { if ($this->_chapter === 0) { $this->title = $this->renderAbsy($block['content']); $this->introduction = ''; $this->_chapter++; } else { $this->_chapter++; $this->_chapters[$this->_chapter] = [ 'headline' => $this->renderAbsy($block['content']), 'content' => [], ]; } return parent::renderHeadline($block); } /** * @inheritdoc */ protected function renderParagraph($block) { if ($this->_chapter < 1) { $this->introduction .= $this->renderAbsy($block['content']); } return parent::renderParagraph($block); } /** * @inheritdoc */ protected function renderList($block) { if ($this->_chapter > 0) { foreach ($block['items'] as $item => $absyElements) { foreach($absyElements as $element) { if ($element[0] === 'link') { $this->_chapters[$this->_chapter]['content'][] = [ 'headline' => $this->renderAbsy($element['text']), 'file' => $element['url'], ]; } } } } return parent::renderList($block); } }