src/Charcoal/Admin/Ui/ActionContainerTrait.php
protected function parseActionUrl($url, $action = null, $renderer = null)
    {
        unset($action);

        if ($renderer === null) {
            $renderer = $this->getActionRenderer();
        }

        if ($url instanceof Translation) {
            $url = (string)$url;
        }

        $url = trim($url);

        if (empty($url) && !is_numeric($url)) {
            return '#';
        }

        if ($renderer === null) {
            /** @todo Shame! Force `{{ id }}` to use "obj_id" GET parameter… */
            $objId = filter_input(INPUT_GET, 'obj_id', FILTER_SANITIZE_STRING);
            if ($objId) {
                $url = preg_replace('~\{\{\s*(obj_)?id\s*\}\}~', $objId, $url);
            }

            /** @todo Shame! Force `{{ type }}` to use "obj_type" GET parameter… */
            $objType = filter_input(INPUT_GET, 'obj_type', FILTER_SANITIZE_STRING);
            if ($objType) {
                $url = preg_replace('~\{\{\s*(obj_)?type\s*\}\}~', $objType, $url);
            }

            if ($url && strpos($url, ':') === false && !in_array($url[0], [ '/', '#', '?' ])) {
                $url = $this->adminUrl().$url;
            }

            return $url;
        } elseif ($renderer instanceof ViewableInterface) {
            $url = $renderer->renderTemplate($url);

            if ($url && strpos($url, ':') === false && !in_array($url[0], [ '/', '#', '?' ])) {
                $url = $this->adminUrl().$url;
            }
        }

        return $url;
    }
protected function parseActionUrl($url, $action = null, $renderer = null)
    {
        unset($action);

        if ($renderer === null) {
            $renderer = $this->getActionRenderer();
        }

        if ($url instanceof Translation) {
            $url = (string)$url;
        }

        $url = trim($url);

        if (empty($url) && !is_numeric($url)) {
            return '#';
        }

        if ($renderer === null) {
            /** @todo Shame! Force `{{ id }}` to use "obj_id" GET parameter… */
            $objId = filter_input(INPUT_GET, 'obj_id', FILTER_SANITIZE_STRING);
            if ($objId) {
                $url = preg_replace('~\{\{\s*(obj_)?id\s*\}\}~', $objId, $url);
            }

            /** @todo Shame! Force `{{ type }}` to use "obj_type" GET parameter… */
            $objType = filter_input(INPUT_GET, 'obj_type', FILTER_SANITIZE_STRING);
            if ($objType) {
                $url = preg_replace('~\{\{\s*(obj_)?type\s*\}\}~', $objType, $url);
            }

            if ($url && strpos($url, ':') === false && !in_array($url[0], [ '/', '#', '?' ])) {
                $url = $this->adminUrl().$url;
            }

            return $url;
        } elseif ($renderer instanceof ViewableInterface) {
            $url = $renderer->renderTemplate($url);

            if ($url && strpos($url, ':') === false && !in_array($url[0], [ '/', '#', '?' ])) {
                $url = $this->adminUrl().$url;
            }
        }

        return $url;
    }
protected function parseActionUrl ( $ url , $ action = null , $ renderer = null ) { unset ( $ action ) ; if ( $ renderer === null ) { $ renderer = $ this -> getActionRenderer ( ) ; } if ( $ url instanceof Translation ) { $ url = ( string ) $ url ; } $ url = trim ( $ url ) ; if ( empty ( $ url ) && ! is_numeric ( $ url ) ) { return '#' ; } if ( $ renderer === null ) { /** @todo Shame! Force `{{ id }}` to use "obj_id" GET parameter… */ $ objId = filter_input ( INPUT_GET , 'obj_id' , FILTER_SANITIZE_STRING ) ; if ( $ objId ) { $ url = preg_replace ( '~\{\{\s*(obj_)?id\s*\}\}~' , $ objId , $ url ) ; } /** @todo Shame! Force `{{ type }}` to use "obj_type" GET parameter… */ $ objType = filter_input ( INPUT_GET , 'obj_type' , FILTER_SANITIZE_STRING ) ; if ( $ objType ) { $ url = preg_replace ( '~\{\{\s*(obj_)?type\s*\}\}~' , $ objType , $ url ) ; } if ( $ url && strpos ( $ url , ':' ) === false && ! in_array ( $ url [ 0 ] , [ '/' , '#' , '?' ] ) ) { $ url = $ this -> adminUrl ( ) . $ url ; } return $ url ; } elseif ( $ renderer instanceof ViewableInterface ) { $ url = $ renderer -> renderTemplate ( $ url ) ; if ( $ url && strpos ( $ url , ':' ) === false && ! in_array ( $ url [ 0 ] , [ '/' , '#' , '?' ] ) ) { $ url = $ this -> adminUrl ( ) . $ url ; } } return $ url ; }
Parse the given UI action URL.

@param  string $url      The action's URL.
@param  mixed  $action   The action structure.
@param  mixed  $renderer The renderer.
@return array Resolved action structure.
Parse the given UI action URL .