protected function createDedicationAndEpigraph($book_contents, $metadata)
{
$front_matter_printf = '<div class="front-matter %s" id="%s">';
$front_matter_printf .= '<div class="front-matter-title-wrap"><h3 class="front-matter-number">%s</h3><h1 class="front-matter-title">%s</h1></div>';
$front_matter_printf .= '<div class="ugc front-matter-ugc">%s</div>%s';
$front_matter_printf .= '</div>';
$vars = array('post_title' => '', 'stylesheet' => $this->stylesheet, 'post_content' => '', 'isbn' => @$metadata['pb_ebook_isbn'], 'lang' => $this->lang);
$i = $this->frontMatterPos;
$last_pos = false;
foreach (array('dedication', 'epigraph') as $compare) {
foreach ($book_contents['front-matter'] as $front_matter) {
if (!$front_matter['export']) {
continue;
// Skip
}
$front_matter_id = $front_matter['ID'];
$subclass = \Pressbooks\Taxonomy::getFrontMatterType($front_matter_id);
if ($compare != $subclass) {
continue;
//Skip
}
$slug = $front_matter['post_name'];
$title = get_post_meta($front_matter_id, 'pb_show_title', true) ? $front_matter['post_title'] : '';
$content = $this->kneadHtml($front_matter['post_content'], 'front-matter', $i);
$vars['post_title'] = $front_matter['post_title'];
$vars['post_content'] = sprintf($front_matter_printf, $subclass, $slug, $i, Sanitize\decode($title), $content, '');
$file_id = 'front-matter-' . sprintf('%03s', $i);
$filename = "{$file_id}-{$slug}.{$this->filext}";
file_put_contents($this->tmpDir . "/OEBPS/{$filename}", $this->loadTemplate($this->dir . '/templates/epub201/html.php', $vars));
$this->manifest[$file_id] = array('ID' => $front_matter['ID'], 'post_title' => $front_matter['post_title'], 'filename' => $filename);
++$i;
$last_pos = $i;
}
}
$this->frontMatterPos = $i;
if ($last_pos) {
$this->frontMatterLastPos = $last_pos - 1;
}
}