You are here

class SocialEventManagersConfigOverride in Open Social 8.9

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

Class SocialEventManagersConfigOverride.

Example configuration override.

@package Drupal\social_event_managers

Hierarchy

Expanded class hierarchy of SocialEventManagersConfigOverride

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

File

modules/social_features/social_event/modules/social_event_managers/src/SocialEventManagersConfigOverride.php, line 16

Namespace

Drupal\social_event_managers
View source
class SocialEventManagersConfigOverride implements ConfigFactoryOverrideInterface {

  /**
   * Load overrides.
   */
  public function loadOverrides($names) {
    $overrides = [];
    $config_name = 'core.entity_form_display.node.event.default';
    if (in_array($config_name, $names)) {
      $config = \Drupal::service('config.factory')
        ->getEditable($config_name);

      // Add a field group.
      $field_group_settings = $config
        ->get('third_party_settings.field_group');
      $field_group_settings['group_event_managers'] = [
        'children' => [
          'field_event_managers',
        ],
        'parent_name' => '',
        'weight' => 9,
        'label' => 'Event organisers',
        'format_type' => 'fieldset',
        'format_settings' => [
          'label' => 'Event organisers',
          'id' => 'event-managers',
          'classes' => 'card',
          'required_fields' => FALSE,
        ],
      ];

      // Add the field to the content.
      $content = $config
        ->get('content');
      $content['field_event_managers'] = [];
      $content['field_event_managers']['settings'] = [];
      $content['field_event_managers']['settings']['match_operator'] = 'CONTAINS';
      $content['field_event_managers']['settings']['placeholder'] = '';
      $content['field_event_managers']['settings']['size'] = '60';
      $content['field_event_managers']['type'] = 'entity_reference_autocomplete';
      $content['field_event_managers']['weight'] = 0;
      if (!isset($content['field_event_managers']['third_party_settings'])) {
        $content['field_event_managers']['third_party_settings'] = [];
      }
      $overrides[$config_name] = [
        'third_party_settings' => [
          'field_group' => $field_group_settings,
        ],
        'content' => $content,
      ];
    }
    return $overrides;
  }

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

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