Pressbooks\Modules\Export\Mpdf\Pdf::addPartsAndChapters PHP Method

addPartsAndChapters() public method

public addPartsAndChapters ( $contents )
    function addPartsAndChapters($contents)
    {
        // change the numbering system to numeric
        // iterate through, parts, chapters, back-matter
        $first_iteration = true;
        $i = 1;
        $page_options = array();
        foreach ($contents as $page) {
            if ('front-matter' == $page['post_type']) {
                continue;
                //skip all front-matter
            }
            if (true == $first_iteration) {
                $page_options['pagenumstyle'] = 1;
            }
            $page['chapter_num'] = $i;
            $this->addPage($page, $page_options);
            $first_iteration = false;
            if ('part' != $page['post_type']) {
                $i++;
            }
        }
    }