Pimcore\Controller\Router\Route\Frontend::assemble PHP Method

assemble() public method

public assemble ( array $data = [], boolean $reset = false, boolean $encode = true, boolean $partial = false ) : string
$data array
$reset boolean
$encode boolean
$partial boolean
return string
    public function assemble($data = [], $reset = false, $encode = true, $partial = false)
    {
        $pathPrefix = "";
        $hasPath = false;
        // try to get document from controller front
        $front = \Zend_Controller_Front::getInstance();
        if (array_key_exists("document", $data) && $data["document"] instanceof Document) {
            $pathPrefix = $data["document"]->getFullPath();
            unset($data["document"]);
            $hasPath = true;
        } elseif ($doc = $front->getRequest()->getParam("document")) {
            $pathPrefix = $doc->getFullPath();
            $hasPath = true;
        }
        $pathPrefix = ltrim($pathPrefix, "/");
        // this is only to append parameters to an existing document
        if (!$reset) {
            $data = array_merge($_GET, $data);
        }
        if (!empty($data)) {
            return $pathPrefix . "?" . array_urlencode($data);
        } elseif ($hasPath) {
            return $pathPrefix;
        }
        return "~NOT~SUPPORTED~";
    }