Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,25 @@ if (options.providers === undefined || options.providers.length === 0) {
throw new TypeError('Media providers are not defined.');
}

/**
* Get the drives
*
* @param {Array} adapterNames
* @param {String} provider
*
* @return {Array}
*/
const getDrives = (adapterNames, provider) => {
const drives = [];
adapterNames.map((name) => drives.push({ root: `${provider}-${name}:/`, displayName: name }));

return drives;
};

// Load disks from options
const loadedDisks = options.providers.map((disk) => ({
displayName: disk.displayName,
drives: disk.adapterNames.map(
(account, index) => ({ root: `${disk.name}-${index}:/`, displayName: account }),
),
drives: getDrives(disk.adapterNames, disk.name),
}));

if (loadedDisks[0].drives[0] === undefined || loadedDisks[0].drives.length === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* extension: "png"
* fileType: "image/png"
* height: 44
* path: "local-0:/powered_by.png"
* path: "local-images:/powered_by.png"
* thumb: undefined
* width: 294
* }
Expand Down
2 changes: 1 addition & 1 deletion layouts/joomla/form/field/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
$url = ($readonly ? ''
: ($link ?: 'index.php?option=com_media&view=media&tmpl=component&asset='
. $asset . '&author=' . $authorId)
. '&fieldid={field-media-id}&path=local-0:/' . $folder);
. '&fieldid={field-media-id}&path=local-images:/' . $folder);

// Correctly route the url to ensure it's correctly using sef modes and subfolders
$url = Route::_($url);
Expand Down
2 changes: 1 addition & 1 deletion plugins/editors/tinymce/tinymce.php
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ public function onDisplay(
$scriptOptions['uploadUri'] = $uploadUrl;

// @TODO have a way to select the adapter, similar to $levelParams->get('path', '');
$scriptOptions['comMediaAdapter'] = 'local-0:';
$scriptOptions['comMediaAdapter'] = 'local-images:';
}

// Convert pt to px in dropdown
Expand Down
7 changes: 6 additions & 1 deletion plugins/filesystem/local/local.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ public function getAdapters()
{
$directoryPath = JPATH_ROOT . '/' . $directoryEntity->directory;
$directoryPath = rtrim($directoryPath) . '/';
$adapters[] = new \Joomla\Plugin\Filesystem\Local\Adapter\LocalAdapter($directoryPath, $directoryEntity->directory);

$adapter = new \Joomla\Plugin\Filesystem\Local\Adapter\LocalAdapter(
$directoryPath, $directoryEntity->directory
);

$adapters[$adapter->getAdapterName()] = $adapter;
}
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/filesystem/local/local.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
label="PLG_FILESYSTEM_LOCAL_DIRECTORIES_LABEL"
multiple="true"
layout="joomla.form.field.subform.repeatable-table"
buttons="add,remove"
buttons="add,remove,move"
default='[{"directory":"images"}]'
>
<form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class MediaListPage extends AdminListPage
* @var string
* @since 4.0.0
*/
public static $url = "administrator/index.php?option=com_media&path=local-0:/";
public static $url = "administrator/index.php?option=com_media&path=local-images:/";

/**
* Page title of the media manager listing page.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ public function openImageEditorUsingActionMenu(Media $I)
$I->amOnPage(MediaListPage::$url);
$I->waitForMediaLoaded();
$I->clickOnActionInMenuOf('powered_by.png', MediaListPage::$editAction);
$I->seeInCurrentUrl(MediaFilePage::$url . '&path=local-0:/powered_by.png');
$I->seeInCurrentUrl(MediaFilePage::$url . '&path=local-images:/powered_by.png');
}

/**
Expand Down Expand Up @@ -894,7 +894,7 @@ public function synchronizeAppStateWithSessionStorage(Media $I)
$I->amOnPage(MediaListPage::$url);
$I->waitForMediaLoaded();
$json = $I->executeJS('return sessionStorage.getItem("' . MediaListPage::$storageKey . '")');
$I->assertContains('"selectedDirectory":"local-0:/"', $json);
$I->assertContains('"selectedDirectory":"local-images:/"', $json);
$I->assertContains('"showInfoBar":false', $json);
$I->assertContains('"listView":"grid"', $json);
$I->assertContains('"gridSize":"md"', $json);
Expand All @@ -904,7 +904,7 @@ public function synchronizeAppStateWithSessionStorage(Media $I)
$I->click(MediaListPage::$increaseThumbnailSizeButton);
$I->click(MediaListPage::$toggleListViewButton);
$json = $I->executeJS('return sessionStorage.getItem("' . MediaListPage::$storageKey . '")');
$I->assertContains('"selectedDirectory":"local-0:/banners"', $json);
$I->assertContains('"selectedDirectory":"local-images:/banners"', $json);
$I->assertContains('"showInfoBar":true', $json);
$I->assertContains('"listView":"table"', $json);
$I->assertContains('"gridSize":"lg"', $json);
Expand Down