protected function get_listing_my()

in lib.php [658:693]


    protected function get_listing_my($path = '') {
        $path = (empty($path)) ? '/' : $path;

        $list = [];
        if ($this->path_is_upload($path) !== true) {
            $onedrive = $this->get_onedrive_apiclient();
            $contents = $onedrive->get_contents($path);
            $list = $this->contents_api_response_to_list($contents['value'], $path, 'onedrive');
        } else {
            $list = [];
        }

        // Generate path.
        $strmyfiles = get_string('myfiles', 'repository_office365');
        $breadcrumb = [['name' => $this->name, 'path' => '/'], ['name' => $strmyfiles, 'path' => '/my/']];
        $pathparts = explode('/', $path);
        $curpath = '/my';

        // Remove empty paths (we do this in a separate loop for proper upload detection in the next loop.
        foreach ($pathparts as $i => $pathpart) {
            if (empty($pathpart)) {
                unset($pathparts[$i]);
            }
        }
        $pathparts = array_values($pathparts);

        foreach ($pathparts as $i => $pathpart) {
            $curpath .= '/'.$pathpart;
            $pathname = $pathpart;
            if ($i === (count($pathparts) - 1) && $pathpart === 'upload') {
                $pathname = get_string('upload', 'repository_office365');
            }
            $breadcrumb[] = ['name' => $pathname, 'path' => $curpath];
        }
        return [$list, $breadcrumb];
    }