src/Loops/Service/WebCore.php
public static function getPagePathFromClassname($classname, $page_parameter = [], Loops $loops = NULL) {
        $count = count($page_parameter);

        if(!$routes = self::getRoutes($loops ?: Loops::getCurrentLoops())) {
            return FALSE;
        }

        $routes = array_filter($routes, function($value, $key) use ($classname, $count) {
            if($classname != str_replace("*", "_", $value)) {
                return FALSE;
            }

            if(substr_count($key, "*") > $count) {
                return FALSE;
            }

            return TRUE;
        }, ARRAY_FILTER_USE_BOTH);

        if(!$routes) {
            return FALSE;
        }

        $pagepath = key($routes);

        while($page_parameter && (($pos = strpos($pagepath, "*")) !== FALSE)) {
            $pagepath = substr($pagepath, 0, $pos).array_shift($page_parameter).substr($pagepath, $pos+1);
        }

        return ltrim($pagepath, "/");
    }
public static function getPagePathFromClassname($classname, $page_parameter = [], Loops $loops = NULL) {
        $count = count($page_parameter);

        if(!$routes = self::getRoutes($loops ?: Loops::getCurrentLoops())) {
            return FALSE;
        }

        $routes = array_filter($routes, function($value, $key) use ($classname, $count) {
            if($classname != str_replace("*", "_", $value)) {
                return FALSE;
            }

            if(substr_count($key, "*") > $count) {
                return FALSE;
            }

            return TRUE;
        }, ARRAY_FILTER_USE_BOTH);

        if(!$routes) {
            return FALSE;
        }

        $pagepath = key($routes);

        while($page_parameter && (($pos = strpos($pagepath, "*")) !== FALSE)) {
            $pagepath = substr($pagepath, 0, $pos).array_shift($page_parameter).substr($pagepath, $pos+1);
        }

        return ltrim($pagepath, "/");
    }
public static function getPagePathFromClassname ( $ classname , $ page_parameter = [ ] , Loops $ loops = NULL ) { $ count = count ( $ page_parameter ) ; if ( ! $ routes = self :: getRoutes ( $ loops ? : Loops :: getCurrentLoops ( ) ) ) { return FALSE ; } $ routes = array_filter ( $ routes , function ( $ value , $ key ) use ( $ classname , $ count ) { if ( $ classname != str_replace ( "*" , "_" , $ value ) ) { return FALSE ; } if ( substr_count ( $ key , "*" ) > $ count ) { return FALSE ; } return TRUE ; } , ARRAY_FILTER_USE_BOTH ) ; if ( ! $ routes ) { return FALSE ; } $ pagepath = key ( $ routes ) ; while ( $ page_parameter && ( ( $ pos = strpos ( $ pagepath , "*" ) ) !== FALSE ) ) { $ pagepath = substr ( $ pagepath , 0 , $ pos ) . array_shift ( $ page_parameter ) . substr ( $ pagepath , $ pos + 1 ) ; } return ltrim ( $ pagepath , "/" ) ; }
Generates the page path for a page element

This function also replaces the page parameter placeholders with given arguments

@param string|object $classname The classname of the element or an object
@param array<string> $page_parameter The page parameter that will be filled into the placeholders
@param Loops Use this loops context instead of the default one
Generates the page path for a page element