src/View/ViewableData.php
public function CSSClasses($stopAtClass = self::class)
    {
        $classes       = [];
        $classAncestry = array_reverse(ClassInfo::ancestry(static::class));
        $stopClasses   = ClassInfo::ancestry($stopAtClass);

        foreach ($classAncestry as $class) {
            if (in_array($class, $stopClasses)) {
                break;
            }
            $classes[] = $class;
        }

        // optionally add template identifier
        if (isset($this->template) && !in_array($this->template, $classes)) {
            $classes[] = $this->template;
        }

        // Strip out namespaces
        $classes = preg_replace('#.*\\\\#', '', $classes);

        return Convert::raw2att(implode(' ', $classes));
    }
public function CSSClasses($stopAtClass = self::class)
    {
        $classes       = [];
        $classAncestry = array_reverse(ClassInfo::ancestry(static::class));
        $stopClasses   = ClassInfo::ancestry($stopAtClass);

        foreach ($classAncestry as $class) {
            if (in_array($class, $stopClasses)) {
                break;
            }
            $classes[] = $class;
        }

        // optionally add template identifier
        if (isset($this->template) && !in_array($this->template, $classes)) {
            $classes[] = $this->template;
        }

        // Strip out namespaces
        $classes = preg_replace('#.*\\\\#', '', $classes);

        return Convert::raw2att(implode(' ', $classes));
    }
public function CSSClasses ( $ stopAtClass = self :: class ) { $ classes = [ ] ; $ classAncestry = array_reverse ( ClassInfo :: ancestry ( static :: class ) ) ; $ stopClasses = ClassInfo :: ancestry ( $ stopAtClass ) ; foreach ( $ classAncestry as $ class ) { if ( in_array ( $ class , $ stopClasses ) ) { break ; } $ classes [ ] = $ class ; } // optionally add template identifier if ( isset ( $ this -> template ) && ! in_array ( $ this -> template , $ classes ) ) { $ classes [ ] = $ this -> template ; } // Strip out namespaces $ classes = preg_replace ( '#.*\\\\#' , '' , $ classes ) ; return Convert :: raw2att ( implode ( ' ' , $ classes ) ) ; }
Get part of the current classes ancestry to be used as a CSS class.

This method returns an escaped string of CSS classes representing the current classes ancestry until it hits a
stop point - e.g. "Page DataObject ViewableData".

@param string $stopAtClass the class to stop at (default: ViewableData)
@return string
@uses ClassInfo
Get part of the current classes ancestry to be used as a CSS class .