/** * @param DocumentInterface $document * * @return array */ protected function fetchDocumentTemplateValues(DocumentInterface $document) { $relatedSection = $this->getRelatedSection(); return array_merge(parent::fetchDocumentTemplateValues($document), ['relatedDocument' => $this->getDocumentRelation($document, $relatedSection)->first(), 'relatedSection' => $relatedSection, 'relatedField' => $this->getRelatedField()]); }