You are here

class SocialDownloadCountConfigOverride in Open Social 8.7

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php \Drupal\social_download_count\SocialDownloadCountConfigOverride
  2. 8 modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php \Drupal\social_download_count\SocialDownloadCountConfigOverride
  3. 8.2 modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php \Drupal\social_download_count\SocialDownloadCountConfigOverride
  4. 8.3 modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php \Drupal\social_download_count\SocialDownloadCountConfigOverride
  5. 8.4 modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php \Drupal\social_download_count\SocialDownloadCountConfigOverride
  6. 8.5 modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php \Drupal\social_download_count\SocialDownloadCountConfigOverride
  7. 8.6 modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php \Drupal\social_download_count\SocialDownloadCountConfigOverride
  8. 8.8 modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php \Drupal\social_download_count\SocialDownloadCountConfigOverride
  9. 10.3.x modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php \Drupal\social_download_count\SocialDownloadCountConfigOverride
  10. 10.0.x modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php \Drupal\social_download_count\SocialDownloadCountConfigOverride
  11. 10.1.x modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php \Drupal\social_download_count\SocialDownloadCountConfigOverride
  12. 10.2.x modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php \Drupal\social_download_count\SocialDownloadCountConfigOverride

Class SocialDownloadCountConfigOverride.

Example configuration override.

@package Drupal\social_download_count

Hierarchy

Expanded class hierarchy of SocialDownloadCountConfigOverride

2 string references to 'SocialDownloadCountConfigOverride'
SocialDownloadCountConfigOverride::getCacheSuffix in modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php
The string to append to the configuration static cache name.
social_download_count.services.yml in modules/social_features/social_download_count/social_download_count.services.yml
modules/social_features/social_download_count/social_download_count.services.yml
1 service uses SocialDownloadCountConfigOverride
social_download_count.overrider in modules/social_features/social_download_count/social_download_count.services.yml
\Drupal\social_download_count\SocialDownloadCountConfigOverride

File

modules/social_features/social_download_count/src/SocialDownloadCountConfigOverride.php, line 15

Namespace

Drupal\social_download_count
View source
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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SocialDownloadCountConfigOverride::createConfigObject public function Creates a configuration object for use during install and synchronization. Overrides ConfigFactoryOverrideInterface::createConfigObject
SocialDownloadCountConfigOverride::getCacheableMetadata public function Gets the cacheability metadata associated with the config factory override. Overrides ConfigFactoryOverrideInterface::getCacheableMetadata
SocialDownloadCountConfigOverride::getCacheSuffix public function The string to append to the configuration static cache name. Overrides ConfigFactoryOverrideInterface::getCacheSuffix
SocialDownloadCountConfigOverride::loadOverrides public function Load overrides. Overrides ConfigFactoryOverrideInterface::loadOverrides