You are here

class SocialBookConfigOverride in Open Social 8

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

Class SocialBookConfigOverride.

Example configuration override.

@package Drupal\social_book

Hierarchy

Expanded class hierarchy of SocialBookConfigOverride

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

File

modules/social_features/social_book/src/SocialBookConfigOverride.php, line 15

Namespace

Drupal\social_book
View source
class SocialBookConfigOverride implements ConfigFactoryOverrideInterface {

  /**
   * Load overrides.
   */
  public function loadOverrides($names) {
    $overrides = [];

    // Set hero title block for book content type.
    $config_names = [
      'block.block.socialbase_pagetitleblock',
      'block.block.socialblue_pagetitleblock',
    ];
    foreach ($config_names as $config_name) {
      if (in_array($config_name, $names)) {
        $config = \Drupal::service('config.factory')
          ->getEditable($config_name);
        $bundles = $config
          ->get('visibility.node_type.bundles');
        $bundles['book'] = 'book';
        $overrides[$config_name] = [
          'visibility' => [
            'node_type' => [
              'bundles' => $bundles,
            ],
          ],
        ];
      }
    }
    return $overrides;
  }

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

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