public function ContentSyncSettings::getSiteName in CMS Content Sync 2.1.x
Same name and namespace in other branches
- 8 src/Controller/ContentSyncSettings.php \Drupal\cms_content_sync\Controller\ContentSyncSettings::getSiteName()
- 2.0.x src/Controller/ContentSyncSettings.php \Drupal\cms_content_sync\Controller\ContentSyncSettings::getSiteName()
Parameters
bool $config_only:
Return value
null|string
File
- src/
Controller/ ContentSyncSettings.php, line 472
Class
- ContentSyncSettings
- Class ContentSyncSettings.
Namespace
Drupal\cms_content_sync\ControllerCode
public function getSiteName() {
if (null !== $this->siteName) {
return $this->siteName;
}
// Allow overwritting of the site_name from the global $settings.
if (Settings::get('cms_content_sync_site_name')) {
return $this->siteName = Settings::get('cms_content_sync_site_name');
}
// If we aren't connected yet, don't ask the Sync Core for our name (will
// throw an exception).
if ($this
->getSiteId()) {
$core = SyncCoreFactory::getAnySyncCore();
if ($core) {
$stored = $core
->getSiteName();
if ($stored) {
return $this->siteName = $stored;
}
}
}
$this->siteName = $this->configFactory
->get('system.site')
->get('name');
return $this->siteName;
}