function content_sync_get_content_directory in Content Synchronization 8
Same name and namespace in other branches
- 8.2 content_sync.module \content_sync_get_content_directory()
- 3.0.x content_sync.module \content_sync_get_content_directory()
Returns the path of a content directory.
Content directories are configured using $content_directories in settings.php
Parameters
string $type: The type of content directory to return.
Return value
string The content directory path.
Throws
\Exception
5 calls to content_sync_get_content_directory()
- ContentFileStorageFactory::getActive in src/
Content/ ContentFileStorageFactory.php - Returns a FileStorage object working with the active content directory.
- ContentFileStorageFactory::getSync in src/
Content/ ContentFileStorageFactory.php - Returns a FileStorage object working with the sync content directory.
- ContentImportForm::buildForm in src/
Form/ ContentImportForm.php - Form constructor.
- ContentImportForm::submitForm in src/
Form/ ContentImportForm.php - Form submission handler.
- processContentDirectoryBatch in ./
content_sync.batch.inc - Processes the content sync import batch
File
- ./
content_sync.module, line 176 - Allows site administrators to modify content.
Code
function content_sync_get_content_directory($type) {
global $content_directories;
// @todo Remove fallback in Drupal 9. https://www.drupal.org/node/2574943
/*if ($type == CONTENT_SYNC_DIRECTORY &&
!isset($content_directories[CONTENT_SYNC_DIRECTORY])
&& isset($content_directories[CONTENT_STAGING_DIRECTORY])) {
$type = CONTENT_STAGING_DIRECTORY;
}*/
if ($type == 'sync' && !isset($content_directories['sync']) && isset($content_directories['staging'])) {
$type = 'staging';
}
if (!empty($content_directories[$type])) {
return $content_directories[$type];
}
// @todo https://www.drupal.org/node/2696103 Throw a more specific exception.
//throw new \Exception("The content directory type '$type' does not exist");
drupal_set_message(t("The content directory type '{$type}' does not exist"), 'error');
}