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

getThemeCss() public method

Get current child and parent theme css files. Child themes only have one parent theme, and 99% of the time this is 'Luther' or /pressbooks-book/ whose stylesheet is named 'style.css'
public getThemeCss ( object $theme ) : string
$theme object
return string $css
    function getThemeCss($theme)
    {
        $css = '';
        // get parent theme files
        if (is_object($theme->parent())) {
            $parent_files = $theme->parent()->get_files('css');
            // exclude admin files
            $parents = $this->stripUnwantedStyles($parent_files);
            // hopefully there is something left for us to grab
            if (!empty($parents)) {
                foreach ($parents as $parent) {
                    $css .= file_get_contents($parent) . "\n";
                }
            }
        }
        // get child theme files
        $child_files = $theme->get_files('css');
        // exclude admin files
        $children = $this->stripUnwantedStyles($child_files);
        if (!empty($children)) {
            foreach ($children as $child) {
                $css .= file_get_contents($child) . "\n";
            }
        }
        return $css;
    }