You are here

class SocialFollowTagOverrides in Open Social 10.0.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_follow_taxonomy/modules/social_follow_tag/src/SocialFollowTagOverrides.php \Drupal\social_follow_tag\SocialFollowTagOverrides
  2. 10.1.x modules/social_features/social_follow_taxonomy/modules/social_follow_tag/src/SocialFollowTagOverrides.php \Drupal\social_follow_tag\SocialFollowTagOverrides
  3. 10.2.x modules/social_features/social_follow_taxonomy/modules/social_follow_tag/src/SocialFollowTagOverrides.php \Drupal\social_follow_tag\SocialFollowTagOverrides

Provide config overrides for the 'social_follow_tag' module.

@package Drupal\social_follow_tag

Hierarchy

Expanded class hierarchy of SocialFollowTagOverrides

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

File

modules/social_features/social_follow_taxonomy/modules/social_follow_tag/src/SocialFollowTagOverrides.php, line 15

Namespace

Drupal\social_follow_tag
View source
class SocialFollowTagOverrides implements ConfigFactoryOverrideInterface {

  /**
   * The config factory.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * Constructs the configuration override.
   *
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The Drupal configuration factory.
   */
  public function __construct(ConfigFactoryInterface $config_factory) {
    $this->configFactory = $config_factory;
  }

  /**
   * {@inheritdoc}
   */
  public function loadOverrides($names) {
    $overrides = [];

    // Add social_tagging taxonomy bundle to follow_term flag config.
    $config_name = 'flag.flag.follow_term';
    $config = $this->configFactory
      ->getEditable($config_name);
    $bundles = $config
      ->get('bundles');
    if (!empty($bundles) && !in_array('social_tagging', $bundles)) {
      array_push($bundles, 'social_tagging');
      if (in_array($config_name, $names)) {
        $overrides[$config_name] = [
          'bundles' => $bundles,
        ];
      }
    }
    return $overrides;
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheSuffix() {
    return 'SocialFollowTagOverrides';
  }

  /**
   * {@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
SocialFollowTagOverrides::$configFactory protected property The config factory.
SocialFollowTagOverrides::createConfigObject public function Creates a configuration object for use during install and synchronization. Overrides ConfigFactoryOverrideInterface::createConfigObject
SocialFollowTagOverrides::getCacheableMetadata public function Gets the cacheability metadata associated with the config factory override. Overrides ConfigFactoryOverrideInterface::getCacheableMetadata
SocialFollowTagOverrides::getCacheSuffix public function The string to append to the configuration static cache name. Overrides ConfigFactoryOverrideInterface::getCacheSuffix
SocialFollowTagOverrides::loadOverrides public function Returns config overrides. Overrides ConfigFactoryOverrideInterface::loadOverrides
SocialFollowTagOverrides::__construct public function Constructs the configuration override.