SocialPostPhotoAlbumConfigOverride.php in Open Social 10.1.x
Same filename and directory in other branches
- 10.3.x modules/social_features/social_post/modules/social_post_album/src/SocialPostPhotoAlbumConfigOverride.php
- 10.0.x modules/social_features/social_post/modules/social_post_album/src/SocialPostPhotoAlbumConfigOverride.php
- 10.2.x modules/social_features/social_post/modules/social_post_album/src/SocialPostPhotoAlbumConfigOverride.php
Namespace
Drupal\social_post_albumFile
modules/social_features/social_post/modules/social_post_album/src/SocialPostPhotoAlbumConfigOverride.phpView source
<?php
namespace Drupal\social_post_album;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Config\ConfigFactoryOverrideInterface;
use Drupal\Core\Config\StorageInterface;
/**
* Provides an overridden elements.
*
* @package Drupal\social_post_album
*/
class SocialPostPhotoAlbumConfigOverride implements ConfigFactoryOverrideInterface {
/**
* Field widget or formatter type per configuration.
*/
const TYPES = [
'core.entity_form_display.post.photo.default' => 'social_post_album_image',
'core.entity_view_display.post.photo.activity' => 'album_image',
];
/**
* {@inheritdoc}
*/
public function loadOverrides($names) {
$overrides = [];
foreach (self::TYPES as $config_name => $type) {
if (in_array($config_name, $names)) {
$overrides[$config_name]['content']['field_post_image']['type'] = $type;
}
}
return $overrides;
}
/**
* {@inheritdoc}
*/
public function getCacheSuffix() {
return 'SocialPostPhotoAlbumConfigOverride';
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata($name) {
return new CacheableMetadata();
}
/**
* {@inheritdoc}
*/
public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) {
return NULL;
}
}
Classes
Name | Description |
---|---|
SocialPostPhotoAlbumConfigOverride | Provides an overridden elements. |