class SocialEventTypeConfigOverride in Open Social 10.3.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_event/modules/social_event_type/src/SocialEventTypeConfigOverride.php \Drupal\social_event_type\SocialEventTypeConfigOverride
- 8 modules/social_features/social_event/modules/social_event_type/src/SocialEventTypeConfigOverride.php \Drupal\social_event_type\SocialEventTypeConfigOverride
- 8.2 modules/social_features/social_event/modules/social_event_type/src/SocialEventTypeConfigOverride.php \Drupal\social_event_type\SocialEventTypeConfigOverride
- 8.3 modules/social_features/social_event/modules/social_event_type/src/SocialEventTypeConfigOverride.php \Drupal\social_event_type\SocialEventTypeConfigOverride
- 8.4 modules/social_features/social_event/modules/social_event_type/src/SocialEventTypeConfigOverride.php \Drupal\social_event_type\SocialEventTypeConfigOverride
- 8.5 modules/social_features/social_event/modules/social_event_type/src/SocialEventTypeConfigOverride.php \Drupal\social_event_type\SocialEventTypeConfigOverride
- 8.6 modules/social_features/social_event/modules/social_event_type/src/SocialEventTypeConfigOverride.php \Drupal\social_event_type\SocialEventTypeConfigOverride
- 8.7 modules/social_features/social_event/modules/social_event_type/src/SocialEventTypeConfigOverride.php \Drupal\social_event_type\SocialEventTypeConfigOverride
- 8.8 modules/social_features/social_event/modules/social_event_type/src/SocialEventTypeConfigOverride.php \Drupal\social_event_type\SocialEventTypeConfigOverride
- 10.0.x modules/social_features/social_event/modules/social_event_type/src/SocialEventTypeConfigOverride.php \Drupal\social_event_type\SocialEventTypeConfigOverride
- 10.1.x modules/social_features/social_event/modules/social_event_type/src/SocialEventTypeConfigOverride.php \Drupal\social_event_type\SocialEventTypeConfigOverride
- 10.2.x modules/social_features/social_event/modules/social_event_type/src/SocialEventTypeConfigOverride.php \Drupal\social_event_type\SocialEventTypeConfigOverride
Class SocialEventTypeConfigOverride.
Example configuration override.
@package Drupal\social_event_type
Hierarchy
- class \Drupal\social_event_type\SocialEventTypeConfigOverride implements ConfigFactoryOverrideInterface
Expanded class hierarchy of SocialEventTypeConfigOverride
2 string references to 'SocialEventTypeConfigOverride'
- SocialEventTypeConfigOverride::getCacheSuffix in modules/
social_features/ social_event/ modules/ social_event_type/ src/ SocialEventTypeConfigOverride.php - The string to append to the configuration static cache name.
- social_event_type.services.yml in modules/
social_features/ social_event/ modules/ social_event_type/ social_event_type.services.yml - modules/social_features/social_event/modules/social_event_type/social_event_type.services.yml
1 service uses SocialEventTypeConfigOverride
- social_event_type.override in modules/
social_features/ social_event/ modules/ social_event_type/ social_event_type.services.yml - \Drupal\social_event_type\SocialEventTypeConfigOverride
File
- modules/
social_features/ social_event/ modules/ social_event_type/ src/ SocialEventTypeConfigOverride.php, line 16
Namespace
Drupal\social_event_typeView source
class SocialEventTypeConfigOverride implements ConfigFactoryOverrideInterface {
/**
* Load overrides.
*/
public function loadOverrides($names) {
$overrides = [];
$config_factory = \Drupal::service('config.factory');
// Override event form display.
$config_name = 'core.entity_form_display.node.event.default';
if (in_array($config_name, $names)) {
$config = $config_factory
->getEditable($config_name);
$children = $config
->get('third_party_settings.field_group.group_title_image.children');
$children[] = 'field_event_type';
$content = $config
->get('content');
$content['field_event_type'] = [
'weight' => 1,
'settings' => [],
'third_party_settings' => [],
'type' => 'options_buttons',
];
$overrides[$config_name] = [
'third_party_settings' => [
'field_group' => [
'group_title_image' => [
'children' => $children,
],
],
],
'content' => $content,
];
}
// Override event displays.
$view_modes = [
'core.entity_view_display.node.event.default',
'core.entity_view_display.node.event.teaser',
];
foreach ($view_modes as $config_name) {
if (in_array($config_name, $names)) {
$config = $config_factory
->getEditable($config_name);
$content = $config
->get('content');
$content['field_event_type'] = [
'type' => 'entity_reference_label',
'weight' => 2,
'label' => 'hidden',
'settings' => [
'link' => FALSE,
],
'third_party_settings' => [],
];
$overrides[$config_name] = [
'content' => $content,
];
}
}
// Override event views.
$event_views = [
'views.view.events' => 'events_overview',
'views.view.group_events' => 'default',
'views.view.upcoming_events' => 'page_community_events',
];
foreach ($event_views as $config_name => $display_name) {
if (in_array($config_name, $names)) {
$overrides[$config_name] = [
'display' => [
$display_name => [
'display_options' => [
'filters' => [
'field_event_type_target_id' => [
'id' => 'field_event_type_target_id',
'table' => 'node__field_event_type',
'field' => 'field_event_type_target_id',
'relationship' => 'none',
'group_type' => 'group',
'admin_label' => '',
'operator' => 'or',
'value' => [],
'group' => 1,
'exposed' => TRUE,
'expose' => [
'operator_id' => 'field_event_type_target_id_op',
'label' => t('What type of events do you want to see?'),
'description' => '',
'use_operator' => FALSE,
'operator' => 'field_event_type_target_id_op',
'identifier' => 'event_type_id',
'required' => FALSE,
'remember' => FALSE,
'multiple' => FALSE,
'remember_roles' => [
'authenticated' => 'authenticated',
'anonymous' => '0',
'administrator' => '0',
'contentmanager' => '0',
'sitemanager' => '0',
],
'reduce' => FALSE,
],
'is_grouped' => FALSE,
'group_info' => [
'label' => '',
'description' => '',
'identifier' => '',
'optional' => TRUE,
'widget' => 'select',
'multiple' => FALSE,
'remember' => FALSE,
'default_group' => 'All',
'default_group_multiple' => [],
'group_items' => [],
],
'reduce_duplicates' => FALSE,
'type' => 'select',
'limit' => TRUE,
'vid' => 'event_types',
'hierarchy' => FALSE,
'error_message' => TRUE,
'plugin_id' => 'taxonomy_index_tid',
],
],
],
],
],
];
}
}
if (isset($overrides['views.view.group_events']['display']['default']['display_options']['filters']['field_event_type_target_id'])) {
$overrides['views.view.group_events']['display']['default']['display_options']['filters']['field_event_type_target_id']['relationship'] = 'gc__node';
}
return $overrides;
}
/**
* {@inheritdoc}
*/
public function getCacheSuffix() {
return 'SocialEventTypeConfigOverride';
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata($name) {
return new CacheableMetadata();
}
/**
* {@inheritdoc}
*/
public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) {
return NULL;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SocialEventTypeConfigOverride:: |
public | function |
Creates a configuration object for use during install and synchronization. Overrides ConfigFactoryOverrideInterface:: |
|
SocialEventTypeConfigOverride:: |
public | function |
Gets the cacheability metadata associated with the config factory override. Overrides ConfigFactoryOverrideInterface:: |
|
SocialEventTypeConfigOverride:: |
public | function |
The string to append to the configuration static cache name. Overrides ConfigFactoryOverrideInterface:: |
|
SocialEventTypeConfigOverride:: |
public | function |
Load overrides. Overrides ConfigFactoryOverrideInterface:: |