class SocialProfileManagerNotesConfigOverride in Open Social 10.0.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_profile/modules/social_profile_manager_notes/src/SocialProfileManagerNotesConfigOverride.php \Drupal\social_profile_manager_notes\SocialProfileManagerNotesConfigOverride
- 8.8 modules/social_features/social_profile/modules/social_profile_manager_notes/src/SocialProfileManagerNotesConfigOverride.php \Drupal\social_profile_manager_notes\SocialProfileManagerNotesConfigOverride
- 10.3.x modules/social_features/social_profile/modules/social_profile_manager_notes/src/SocialProfileManagerNotesConfigOverride.php \Drupal\social_profile_manager_notes\SocialProfileManagerNotesConfigOverride
- 10.1.x modules/social_features/social_profile/modules/social_profile_manager_notes/src/SocialProfileManagerNotesConfigOverride.php \Drupal\social_profile_manager_notes\SocialProfileManagerNotesConfigOverride
- 10.2.x modules/social_features/social_profile/modules/social_profile_manager_notes/src/SocialProfileManagerNotesConfigOverride.php \Drupal\social_profile_manager_notes\SocialProfileManagerNotesConfigOverride
Class SocialProfileManagerNotesConfigOverride.
Example configuration override.
@package Drupal\social_profile_manager_notes
Hierarchy
- class \Drupal\social_profile_manager_notes\SocialProfileManagerNotesConfigOverride implements ConfigFactoryOverrideInterface
Expanded class hierarchy of SocialProfileManagerNotesConfigOverride
2 string references to 'SocialProfileManagerNotesConfigOverride'
- SocialProfileManagerNotesConfigOverride::getCacheSuffix in modules/
social_features/ social_profile/ modules/ social_profile_manager_notes/ src/ SocialProfileManagerNotesConfigOverride.php - The string to append to the configuration static cache name.
- social_profile_manager_notes.services.yml in modules/
social_features/ social_profile/ modules/ social_profile_manager_notes/ social_profile_manager_notes.services.yml - modules/social_features/social_profile/modules/social_profile_manager_notes/social_profile_manager_notes.services.yml
1 service uses SocialProfileManagerNotesConfigOverride
- social_profile_manager_notes.overrider in modules/
social_features/ social_profile/ modules/ social_profile_manager_notes/ social_profile_manager_notes.services.yml - Drupal\social_profile_manager_notes\SocialProfileManagerNotesConfigOverride
File
- modules/
social_features/ social_profile/ modules/ social_profile_manager_notes/ src/ SocialProfileManagerNotesConfigOverride.php, line 17
Namespace
Drupal\social_profile_manager_notesView source
class SocialProfileManagerNotesConfigOverride 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;
}
/**
* Returns config overrides.
*/
public function loadOverrides($names) {
$overrides = [];
$config_names = [
'core.entity_form_display.profile.profile.default',
'core.entity_view_display.profile.profile.default',
];
foreach ($config_names as $config_name) {
if (in_array($config_name, $names)) {
// Grab current configuration and push the new values.
$config = $this->configFactory
->getEditable($config_name);
// We have to add config dependencies to field storage.
$dependencies = $config
->getOriginal('dependencies', FALSE)['config'];
$dependencies[] = 'field.field.profile.profile.field_manager_notes';
$overrides[$config_name]['dependencies']['config'] = $dependencies;
// Add the manager note field to the profile.
$overrides[$config_name]['content']['field_manager_notes'] = [
'weight' => 6,
'settings' => [
'view_mode' => 'default',
'placeholder' => '',
],
'third_party_settings' => [],
'type' => 'comment_default',
'region' => 'content',
'label' => 'visually_hidden',
];
}
}
return $overrides;
}
/**
* {@inheritdoc}
*/
public function getCacheSuffix() {
return 'SocialProfileManagerNotesConfigOverride';
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata($name) {
return new CacheableMetadata();
}
/**
* {@inheritdoc}
*/
public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) {
return NULL;
}
}