SocialDownloadCountConfigOverride.php in Open Social 10.3.x
Same filename and directory in other branches
- 8.9 modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php
- 8 modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php
- 8.2 modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php
- 8.3 modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php
- 8.4 modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php
- 8.5 modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php
- 8.6 modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php
- 8.7 modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php
- 8.8 modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php
- 10.0.x modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php
- 10.1.x modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php
- 10.2.x modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php
Namespace
Drupal\social_download_countFile
modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.phpView source
<?php
namespace Drupal\social_download_count;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Config\ConfigFactoryOverrideInterface;
use Drupal\Core\Config\StorageInterface;
/**
* Class SocialDownloadCountConfigOverride.
*
* Example configuration override.
*
* @package Drupal\social_download_count
*/
class SocialDownloadCountConfigOverride implements ConfigFactoryOverrideInterface {
/**
* Load overrides.
*/
public function loadOverrides($names) {
$overrides = [];
// Set private file system to files field.
$config_name = 'field.storage.node.field_files';
if (in_array($config_name, $names)) {
$overrides[$config_name] = [
'settings' => [
'uri_scheme' => 'private',
],
];
}
// Set download count widget to files fields.
$content_types = [
'book',
'event',
'page',
'topic',
];
foreach ($content_types as $content_type) {
$config_name = "core.entity_view_display.node.{$content_type}.default";
$overrides[$config_name] = [
'content' => [
'field_files' => [
'type' => 'FieldDownloadCount',
],
],
];
}
return $overrides;
}
/**
* {@inheritdoc}
*/
public function getCacheSuffix() {
return 'SocialDownloadCountConfigOverride';
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata($name) {
return new CacheableMetadata();
}
/**
* {@inheritdoc}
*/
public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) {
return NULL;
}
}
Classes
Name | Description |
---|---|
SocialDownloadCountConfigOverride | Class SocialDownloadCountConfigOverride. |