You are here

public function EventAnEnrollOverride::loadOverrides in Open Social 10.2.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollOverride.php \Drupal\social_event_an_enroll\EventAnEnrollOverride::loadOverrides()
  2. 8.3 modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollOverride.php \Drupal\social_event_an_enroll\EventAnEnrollOverride::loadOverrides()
  3. 8.4 modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollOverride.php \Drupal\social_event_an_enroll\EventAnEnrollOverride::loadOverrides()
  4. 8.5 modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollOverride.php \Drupal\social_event_an_enroll\EventAnEnrollOverride::loadOverrides()
  5. 8.6 modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollOverride.php \Drupal\social_event_an_enroll\EventAnEnrollOverride::loadOverrides()
  6. 8.7 modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollOverride.php \Drupal\social_event_an_enroll\EventAnEnrollOverride::loadOverrides()
  7. 8.8 modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollOverride.php \Drupal\social_event_an_enroll\EventAnEnrollOverride::loadOverrides()
  8. 10.3.x modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollOverride.php \Drupal\social_event_an_enroll\EventAnEnrollOverride::loadOverrides()
  9. 10.0.x modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollOverride.php \Drupal\social_event_an_enroll\EventAnEnrollOverride::loadOverrides()
  10. 10.1.x modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollOverride.php \Drupal\social_event_an_enroll\EventAnEnrollOverride::loadOverrides()

Returns config overrides.

Overrides ConfigFactoryOverrideInterface::loadOverrides

File

modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollOverride.php, line 21

Class

EventAnEnrollOverride
Class EventAnEnrollOverride.

Namespace

Drupal\social_event_an_enroll

Code

public function loadOverrides($names) {
  $overrides = [];
  $config_factory = \Drupal::service('config.factory');

  // Add field_event_an_enroll to event form.
  $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_enrollment_methods.children');
    $children[] = 'field_event_an_enroll';
    $content = $config
      ->get('content');
    $content['field_event_an_enroll'] = [
      'weight' => 100,
      'settings' => [
        'display_label' => TRUE,
      ],
      'third_party_settings' => [],
      'type' => 'boolean_checkbox',
      'region' => 'content',
    ];
    $overrides[$config_name] = [
      'third_party_settings' => [
        'field_group' => [
          'group_enrollment_methods' => [
            'children' => $children,
          ],
        ],
      ],
      'content' => $content,
    ];
  }
  $config_name = 'views.view.event_manage_enrollments';
  if (in_array($config_name, $names)) {
    $config = $config_factory
      ->getEditable($config_name);
    $preconfiguration = $config
      ->get('display.default.display_options.fields.views_bulk_operations_bulk_form.preconfiguration.social_event_managers_send_email_action');
    $overrides[$config_name] = [
      'display' => [
        'default' => [
          'display_options' => [
            'fields' => [
              'social_views_bulk_operations_bulk_form_enrollments_1' => [
                'selected_actions' => [
                  'social_event_an_enroll_send_email_action' => 'social_event_an_enroll_send_email_action',
                ],
                'preconfiguration' => [
                  'social_event_an_enroll_send_email_action' => $preconfiguration,
                ],
              ],
            ],
          ],
        ],
      ],
    ];

    // Unset the regular Email.
    $overrides[$config_name]['display']['default']['display_options']['fields']['social_views_bulk_operations_bulk_form_enrollments_1']['selected_actions']['social_event_managers_send_email_action'] = 0;
  }
  return $overrides;
}