Answers an array of custom CSS required for the template.

@return array
480498
public function getCustomCSS()
    {
        // Create CSS Array:
        
        $css = [];
        
        // Merge Custom CSS from Template:
        
        foreach (ClassTools::singleton()->getObjectAncestry($this, self::class) as $class) {
            
            $template = $this->getCustomCSSTemplate($class);
            
            if (SSViewer::hasTemplate($template)) {
                $css = ViewTools::singleton()->renderCSS($this, $template, $css);
            }
            
        }
        
        // Update CSS via Extensions:
        
        $this->extend('updateCustomCSS', $css);
        
        // Filter CSS Array:
        
        $css = array_filter($css);
        
        // Answer CSS Array:
        
        return $css;
    }
896379
public function getTemplates()
    {
        $templates = SSViewer::get_templates_by_class($this, '', __CLASS__);
        // Prefer any custom template
        if ($this->getTemplate()) {
            array_unshift($templates, $this->getTemplate());
        }
        return $templates;
    }
1308816
public function stylesAll(): array
    {
        $styles = [];
        foreach ($this->getAll() as $name => $plugin) {
            $styles[$name] = $plugin->styles();
        }
        return $styles;
    }
473136
public function getThemeCustomizableStyleList()
    {
        if (!isset($this->styleList)) {
            $env = Environment::get();
            $r = $env->getRecord(
                DIRNAME_THEMES.'/'.$this->getThemeHandle(
                ).'/'.DIRNAME_CSS.'/'.FILENAME_STYLE_CUSTOMIZER_STYLES,
                $this->getPackageHandle()
            );
            $this->styleList = \Concrete\Core\StyleCustomizer\StyleList::loadFromXMLFile($r->file);
        }

        return $this->styleList;
    }
164690
public function customCssAction()
    {
        /* @var $siteInfo \Zork\Db\SiteInfo */
        /* @var $model \Grid\Customize\Model\Extra\Model */
        /* @var $structure \Grid\Customize\Model\Extra\Structure */
        $params     = $this->params();
        $request    = $this->getRequest();
        $id         = $params->fromRoute( 'id' );
        $rootId     = is_numeric( $id ) ? (int) $id : null;
        $schema     = $params->fromRoute( 'schema' );
        $locator    = $this->getServiceLocator();
        $siteInfo   = $locator->get( 'Zork\Db\SiteInfo' );

        if ( $schema != $siteInfo->getSchema() )
        {
            $this->getResponse()
                 ->setResultCode( 403 );

            return;
        }

        $model      = $locator->get( 'Grid\Customize\Model\Extra\Model' );
        $structure  = $model->findByRoot( $rootId );

        if ( empty( $structure ) )
        {
            $this->getResponse()
                 ->setResultCode( 404 );

            return;
        }

        $id         = $rootId ?: 'global';
        $url        = $this->url();
        $hash       = $structure->updated->toHash();
        $cssPath    = $url->fromRoute( 'Grid\Customize\Render\CustomCss', array(
            'schema' => $schema,
            'id'     => $id,
            'hash'   => $hash,
        ) );

        $cssFile = static::PUBLIC_DIR . $cssPath;

        if ( ! is_file( $cssFile ) )
        {
            $dir = dirname( $cssFile );

            if ( ! is_dir( $dir ) )
            {
                mkdir( $dir, 0777, true );
            }

            $iterator = new RegexIterator(
                new FileSystemIterator(
                    $dir,
                    FileSystemIterator::SKIP_DOTS |
                    FileSystemIterator::KEY_AS_FILENAME |
                    FileSystemIterator::CURRENT_AS_PATHNAME
                ),
                '#.*[/\\\\]custom\.([^\\.]+|'
                    . preg_quote( $id, '#' )
                    . '\.[^\\.]+)\.css$#'
            );

            foreach ( $iterator as $unlinkPath )
            {
                @ unlink( $unlinkPath );
            }

            $this->getServiceLocator()
                 ->get( 'Grid\Customize\Model\Sheet\Model' )
                 ->findByExtra( $structure )
                 ->render( $cssFile );
        }

        $requestPath = $request->getUri()
                               ->getPath();

        if ( ltrim( $requestPath, '/' ) != ltrim( $cssPath, '/' ) )
        {
            return $this->redirect()
                        ->toUrl( $cssPath );
        }

        $response = Readfile::fromFile( $cssFile, 'text/css' );

        $this->getEvent()
             ->setResponse( $response );

        return $response;
    }
996342
public static function cssToArray($css){
        if(!$css) {
            return array();
        }
        $css = str_replace(' /* Do not edit */', '', $css);
        $oldCssArr = explode("\n", $css);
        $newCssArr = array();
        foreach($oldCssArr as $line) {
            if(false === strpos($line, '{')) {
                continue;
            }

            preg_match('~(?P<selector>[^{]+)(\{)(?P<rules>[^}]+)\}~', $line, $matches);

            foreach($matches as $key => &$match){
                if(is_numeric($key)) {
                    continue;
                }
                $match = trim($match);
                if($key === 'rules') {
                    $ruleSet = array_filter(array_map('trim', explode(';', $match)));
                    $match = array();
                    foreach($ruleSet as $rule) {
                        $rule = array_map('trim', explode(':', $rule));
                        $match[$rule[0]] = $rule[1];
                    }
                }
            }

            $newCssArr[$matches['selector']] = $matches['rules'];
        }
        return $newCssArr;
    }
178323
public function get_css_type() {
        if (array_key_exists($this->type, $this->namedtypes)) {
            return 'type_'.$this->namedtypes[$this->type];
        }
        return 'type_unknown';
    }
1167313
public function getFieldsActivationCss()
    {
        $cssBlocks = [];
        $formConfiguration = $this->getFormObject()->getConfiguration();

        foreach ($formConfiguration->getFields() as $field) {
            $formName = $this->getFormObject()->getName();
            $fieldContainerSelector = $field->getSettings()->getFieldContainerSelector();

            $cssTree = $this->getConditionTreeForField($field)->getCssConditions();

            if (false === empty($cssTree)) {
                $fullNodeData = [];

                foreach ($cssTree as $node) {
                    $fullNodeData[] = 'form[name="' . $formName . '"]' . $node . ' ' . $fieldContainerSelector;
                }

                $nodesSelector = implode(',' . CRLF, $fullNodeData);

                $cssBlocks[] = $this->getSingleFieldCssBlock($formName, $field, $fieldContainerSelector, $nodesSelector);
            }
        }

        return implode(CRLF, $cssBlocks);
    }
768623
private function getType(): array
    {
        if (!$this->type || $this->is('customize_preview')) {
            $this->type = parent::type();
        }

        return $this->type;
    }
284680
public function getAssets()
    {
        $css = $this->theme->getThemeInfoExtendAware('css');
        $js = $this->theme->getThemeInfoExtendAware('javascript');

        return [
            'css' => $css,
            'javascript' => $js,
        ];
    }
8636
protected function getAppliedStyles()
    {
        $applyStyles = $this->owner->config()->apply_styles;
        
        if (is_array($applyStyles)) {
            return $applyStyles;
        } elseif ($applyStyles == 'none') {
            return [];
        }
    }
10077
public function getTemplates()
    {
        $templates = array();

        if ($handle = opendir(Primer::$PATTERN_PATH . '/templates')) {
            while (false !== ($entry = readdir($handle))) {
                if (substr($entry, 0, 1) !== '.') {
                    $templates[] = array(
                        'id' => $entry,
                        'title' => preg_replace('/[^A-Za-z0-9]/', ' ', $entry),
                    );
                }
            }

            closedir($handle);
        }

        return $templates;
    }
439317
private function getCSS()
    {
        $this->domCrawler->filter('style')->each(function ($crawler){$this->css .= $crawler->text();foreach ($crawler as $node){$node->parentNode->removeChild($node);}});
        $parser = new CSS\Parser($this->css);
        $css = $parser->parse();
        if(!$css){
            throw new \Exception('There are no CSS rules provided.');
        }
        return $css;
    }
332911
public function getStylesheets()
    {
        $parse_stylesheets = function ($params, $stylesheets) {
            foreach ($params as $css) {
                if (is_string($css)) {
                    $css = array(
                        'path' => $css,
                        'media' => 'all',
                    );
                }

                $stylesheets[] = $css;
            }

            return $stylesheets;
        };

        // From config.yml
        $stylesheets = $parse_stylesheets(
            $this->getGenerator()->getFromBundleConfig('stylesheets', array()), array()
        );

        // From generator.yml
        $stylesheets = $parse_stylesheets(
            $this->getVariable('stylesheets', array()), $stylesheets
        );

        return $stylesheets;
    }
1140713
public function loadRequirements()
    {
        // Load Required Themed JavaScript:
        
        if (ContentController::config()->load_themed_js) {
            
            foreach ($this->getRequiredThemedJS() as $js) {
                Requirements::themedJavascript($js);
            }
            
        }
        
        // Load Required Themed CSS:
        
        if (ContentController::config()->load_themed_css) {
            
            foreach ($this->getRequiredThemedCSS() as $css => $media) {
                Requirements::themedCSS($css, $media);
            }
            
        }
        
        // Load Required JavaScript:
        
        if (ContentController::config()->load_js) {
            
            foreach ($this->getRequiredJS() as $js) {
                Requirements::javascript($js);
            }
            
        }
        
        // Load Required CSS:
        
        if (ContentController::config()->load_css) {
            
            foreach ($this->getRequiredCSS() as $css => $media) {
                Requirements::css($css, $media);
            }
            
        }
        
        // Load Required Custom CSS:
        
        if (ContentController::config()->load_custom_css) {
            
            if ($css = $this->getCustomCSSAsString()) {
                Requirements::customCSS($css, $this->HTMLID);
            }
            
        }
        
        // Load Required JavaScript Templates:
        
        foreach ($this->getRequiredJSTemplates() as $file => $params) {
            ViewTools::singleton()->loadJSTemplate($file, $params['vars'], $params['id']);
        }
    }
1211806
private function has_custom_css() {
		$query = new \WP_Query(
			array(
				'post_type'              => 'custom_css',
				'post_status'            => 'publish',
				'numberposts'            => 1,
				'update_post_meta_cache' => false,
				'update_post_term_cache' => false,
			)
		);

		if ( $query->have_posts() ) {
			$query->the_post();
			$content = get_the_content();

			// if the content contains a colon, a CSS rule has been added.
			return strpos( $content, ':' ) === false ? false : true;
		}

		return false;
	}
335580
public function getCss()
    {
        if(!$this->includeAssets())
        {
            return '';
        }
        $libraries = $this->getLibrariesInUse();
        $code = '';
        foreach($libraries as $library)
        {
            $code .= $library->getCss() . "\n";
        }
        return $code;
    }