public function getItemPath($value, ?string $valueType = null): string
    {
        try {
            $item = null;

            if (is_string($value) && $valueType === null) {
                $itemUri = parse_url($value);
                if (!is_array($itemUri) || ($itemUri['scheme'] ?? '') === '' || !isset($itemUri['host'])) {
                    throw ItemException::invalidValue($value);
                }

                $item = $this->cmsItemLoader->load(
                    $itemUri['host'],
                    str_replace('-', '_', $itemUri['scheme'])
                );
            } elseif ((is_int($value) || is_string($value)) && is_string($valueType)) {
                $item = $this->cmsItemLoader->load($value, $valueType);
            } elseif ($value instanceof CmsItemInterface) {
                $item = $value;
            }

            if (!$item instanceof CmsItemInterface) {
                throw ItemException::canNotLoadItem();
            }

            return $this->urlGenerator->generate($item);
        } catch (Throwable $t) {
            $this->errorHandler->handleError($t);
        }

        return '';
    }