You are here

function social_event_update_8805 in Open Social 10.2.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_event/social_event.install \social_event_update_8805()
  2. 10.3.x modules/social_features/social_event/social_event.install \social_event_update_8805()
  3. 10.0.x modules/social_features/social_event/social_event.install \social_event_update_8805()
  4. 10.1.x modules/social_features/social_event/social_event.install \social_event_update_8805()

Install new fields for the request to join event.

File

modules/social_features/social_event/social_event.install, line 237
Install, update and uninstall functions for the social_event module.

Code

function social_event_update_8805(&$sandbox) {
  if (!isset($sandbox['total'])) {

    // Install new fields:
    // - event_enrollment.field_request_or_invite_status.
    // - field_enroll_method.
    // - field_event_enroll_outside_group.
    // - event_enrollment.field_request_message.
    $sandbox['configs'] = [
      'field.storage.event_enrollment.field_request_or_invite_status' => [
        'langcode' => 'en',
        'status' => TRUE,
        'dependencies' => [
          'module' => [
            'options',
            'social_event',
          ],
        ],
        'id' => 'event_enrollment.field_request_or_invite_status',
        'field_name' => 'field_request_or_invite_status',
        'entity_type' => 'event_enrollment',
        'type' => 'list_integer',
        'settings' => [
          'allowed_values' => [
            [
              'value' => 0,
              'label' => 'Pending',
            ],
            [
              'value' => 1,
              'label' => 'Approved',
            ],
            [
              'value' => 2,
              'label' => 'Declined',
            ],
            [
              'value' => 3,
              'label' => 'Invited',
            ],
            [
              'value' => 4,
              'label' => 'Pending reply',
            ],
            [
              'value' => 5,
              'label' => 'Accepted and joined',
            ],
            [
              'value' => 6,
              'label' => 'Invalid or expired',
            ],
          ],
          'allowed_values_function' => '',
        ],
        'module' => 'options',
        'locked' => FALSE,
        'cardinality' => 1,
        'translatable' => TRUE,
        'indexes' => [],
        'persist_with_no_fields' => FALSE,
        'custom_storage' => FALSE,
      ],
      'field.field.event_enrollment.event_enrollment.field_request_or_invite_status' => [
        'langcode' => 'en',
        'status' => TRUE,
        'dependencies' => [
          'config' => [
            'field.storage.event_enrollment.field_request_or_invite_status',
          ],
          'module' => [
            'options',
            'social_event',
          ],
        ],
        'id' => 'event_enrollment.event_enrollment.field_request_or_invite_status',
        'field_name' => 'field_request_or_invite_status',
        'entity_type' => 'event_enrollment',
        'bundle' => 'event_enrollment',
        'label' => 'Request or invite status',
        'description' => '',
        'required' => FALSE,
        'translatable' => FALSE,
        'default_value' => [],
        'default_value_callback' => '',
        'settings' => [],
        'field_type' => 'list_integer',
      ],
      'field.storage.node.field_enroll_method' => [
        'langcode' => 'en',
        'status' => TRUE,
        'dependencies' => [
          'module' => [
            'node',
            'options',
          ],
        ],
        'id' => 'node.field_enroll_method',
        'field_name' => 'field_enroll_method',
        'entity_type' => 'node',
        'type' => 'list_integer',
        'settings' => [
          'allowed_values' => [
            0 => [
              'value' => 1,
              'label' => 'Open to enroll - users can enroll for this event without approval',
            ],
            1 => [
              'value' => 2,
              'label' => 'Request to enroll - users can "request to enroll" for this event which event organisers approve/decline',
            ],
            2 => [
              'value' => 3,
              'label' => 'Invite-only - users can only enroll for this event if they are added/invited by event organisers',
            ],
          ],
          'allowed_values_function' => '',
        ],
        'module' => 'options',
        'locked' => FALSE,
        'cardinality' => 1,
        'translatable' => TRUE,
        'indexes' => [],
        'persist_with_no_fields' => FALSE,
        'custom_storage' => FALSE,
      ],
      'field.field.node.event.field_enroll_method' => [
        'langcode' => 'en',
        'status' => TRUE,
        'dependencies' => [
          'config' => [
            'field.storage.node.field_enroll_method',
            'node.type.event',
          ],
          'module' => [
            'options',
          ],
        ],
        'id' => 'node.event.field_enroll_method',
        'field_name' => 'field_enroll_method',
        'entity_type' => 'node',
        'bundle' => 'event',
        'label' => 'Enroll Method',
        'description' => '',
        'required' => TRUE,
        'translatable' => FALSE,
        'default_value' => [
          0 => [
            'value' => 1,
          ],
        ],
        'default_value_callback' => '',
        'settings' => [],
        'field_type' => 'list_integer',
      ],
      'field.storage.node.field_event_enroll_outside_group' => [
        'langcode' => 'en',
        'status' => TRUE,
        'dependencies' => [
          'module' => [
            'node',
          ],
        ],
        'id' => 'node.field_event_enroll_outside_group',
        'field_name' => 'field_event_enroll_outside_group',
        'entity_type' => 'node',
        'type' => 'boolean',
        'settings' => [],
        'module' => 'core',
        'locked' => FALSE,
        'cardinality' => 1,
        'translatable' => TRUE,
        'indexes' => [],
        'persist_with_no_fields' => FALSE,
        'custom_storage' => FALSE,
      ],
      'field.field.node.event.field_event_enroll_outside_group' => [
        'langcode' => 'en',
        'status' => TRUE,
        'dependencies' => [
          'config' => [
            'field.storage.node.field_event_enroll_outside_group',
            'node.type.event',
          ],
        ],
        'id' => 'node.event.field_event_enroll_outside_group',
        'field_name' => 'field_event_enroll_outside_group',
        'entity_type' => 'node',
        'bundle' => 'event',
        'label' => 'Allow non-group members to enroll or request to enroll',
        'description' => 'To allow users who have not join the group of this event to enroll or send request to enroll',
        'required' => FALSE,
        'translatable' => FALSE,
        'default_value' => [
          0 => [
            'value' => 0,
          ],
        ],
        'default_value_callback' => '',
        'settings' => [
          'on_label' => 'On',
          'off_label' => 'Off',
        ],
        'field_type' => 'boolean',
      ],
      'field.storage.event_enrollment.field_request_message' => [
        'langcode' => 'en',
        'status' => TRUE,
        'dependencies' => [
          'module' => [
            'social_event',
          ],
        ],
        'id' => 'event_enrollment.field_request_message',
        'field_name' => 'field_request_message',
        'entity_type' => 'event_enrollment',
        'type' => 'string_long',
        'settings' => [
          'case_sensitive' => FALSE,
        ],
        'module' => 'core',
        'locked' => FALSE,
        'cardinality' => 1,
        'translatable' => TRUE,
        'indexes' => [],
        'persist_with_no_fields' => FALSE,
        'custom_storage' => FALSE,
      ],
      'field.field.event_enrollment.event_enrollment.field_request_message' => [
        'langcode' => 'en',
        'status' => TRUE,
        'dependencies' => [
          'config' => [
            'field.storage.event_enrollment.field_request_message',
          ],
          'module' => [
            'social_event',
          ],
        ],
        'id' => 'event_enrollment.event_enrollment.field_request_message',
        'field_name' => 'field_request_message',
        'entity_type' => 'event_enrollment',
        'bundle' => 'event_enrollment',
        'label' => 'Request message',
        'description' => 'You can leave a message in your request. Once your request is approved, you will receive a notification via email and notification center.',
        'required' => FALSE,
        'translatable' => FALSE,
        'default_value' => [],
        'default_value_callback' => '',
        'settings' => [],
        'field_type' => 'string_long',
      ],
      // New views.
      'views.view.event_manage_enrollment_requests' => [
        'langcode' => 'en',
        'status' => TRUE,
        'dependencies' => [
          'config' => [
            'core.entity_view_mode.profile.table',
            'field.storage.event_enrollment.field_request_message',
            'field.storage.event_enrollment.field_request_or_invite_status',
            'field.storage.profile.field_profile_organization',
            'node.type.event',
          ],
          'module' => [
            'node',
            'options',
            'profile',
            'social_event',
            'user',
          ],
        ],
        'id' => 'event_manage_enrollment_requests',
        'label' => 'Manage event enrollment requests',
        'module' => 'views',
        'description' => '',
        'tag' => '',
        'base_table' => 'event_enrollment_field_data',
        'base_field' => 'id',
        'display' => [
          'default' => [
            'display_plugin' => 'default',
            'id' => 'default',
            'display_title' => 'Master',
            'position' => 0,
            'display_options' => [
              'access' => [
                'type' => 'none',
                'options' => [],
              ],
              'cache' => [
                'type' => 'tag',
                'options' => [],
              ],
              'query' => [
                'type' => 'views_query',
                'options' => [
                  'disable_sql_rewrite' => FALSE,
                  'distinct' => FALSE,
                  'replica' => FALSE,
                  'query_comment' => '',
                  'query_tags' => [],
                ],
              ],
              'exposed_form' => [
                'type' => 'basic',
                'options' => [
                  'submit_button' => 'Apply',
                  'reset_button' => FALSE,
                  'reset_button_label' => 'Reset',
                  'exposed_sorts_label' => 'Sort by',
                  'expose_sort_order' => TRUE,
                  'sort_asc_label' => 'Asc',
                  'sort_desc_label' => 'Desc',
                ],
              ],
              'pager' => [
                'type' => 'full',
                'options' => [
                  'items_per_page' => 10,
                  'offset' => 0,
                  'id' => 0,
                  'total_pages' => NULL,
                  'tags' => [
                    'previous' => '‹ Previous',
                    'next' => 'Next ›',
                    'first' => '« First',
                    'last' => 'Last »',
                  ],
                  'expose' => [
                    'items_per_page' => FALSE,
                    'items_per_page_label' => 'Items per page',
                    'items_per_page_options' => '5, 10, 25, 50',
                    'items_per_page_options_all' => FALSE,
                    'items_per_page_options_all_label' => '- All -',
                    'offset' => FALSE,
                    'offset_label' => 'Offset',
                  ],
                  'quantity' => 9,
                ],
              ],
              'style' => [
                'type' => 'table',
                'options' => [
                  'grouping' => [],
                  'row_class' => '',
                  'default_row_class' => TRUE,
                  'override' => TRUE,
                  'sticky' => FALSE,
                  'caption' => '',
                  'summary' => '',
                  'description' => '',
                  'columns' => [
                    'rendered_entity' => 'rendered_entity',
                    'field_profile_organization' => 'field_profile_organization',
                    'field_request_message' => 'field_request_message',
                    'field_request_or_invite_status' => 'field_request_or_invite_status',
                    'created' => 'created',
                    'operations_1' => 'operations_1',
                  ],
                  'info' => [
                    'rendered_entity' => [
                      'sortable' => FALSE,
                      'default_sort_order' => 'asc',
                      'align' => '',
                      'separator' => '',
                      'empty_column' => FALSE,
                      'responsive' => '',
                    ],
                    'field_profile_organization' => [
                      'sortable' => TRUE,
                      'default_sort_order' => 'asc',
                      'align' => '',
                      'separator' => '',
                      'empty_column' => FALSE,
                      'responsive' => '',
                    ],
                    'field_request_message' => [
                      'sortable' => FALSE,
                      'default_sort_order' => 'asc',
                      'align' => '',
                      'separator' => '',
                      'empty_column' => FALSE,
                      'responsive' => '',
                    ],
                    'field_request_or_invite_status' => [
                      'sortable' => TRUE,
                      'default_sort_order' => 'asc',
                      'align' => '',
                      'separator' => '',
                      'empty_column' => FALSE,
                      'responsive' => '',
                    ],
                    'created' => [
                      'sortable' => TRUE,
                      'default_sort_order' => 'asc',
                      'align' => '',
                      'separator' => '',
                      'empty_column' => FALSE,
                      'responsive' => '',
                    ],
                    'operations_1' => [
                      'align' => '',
                      'separator' => '',
                      'empty_column' => FALSE,
                      'responsive' => '',
                    ],
                  ],
                  'default' => '-1',
                  'empty_table' => TRUE,
                ],
              ],
              'row' => [
                'type' => 'fields',
              ],
              'fields' => [
                'rendered_entity' => [
                  'id' => 'rendered_entity',
                  'table' => 'profile',
                  'field' => 'rendered_entity',
                  'relationship' => 'profile',
                  'group_type' => 'group',
                  'admin_label' => '',
                  'label' => 'Enrollee',
                  'exclude' => FALSE,
                  'alter' => [
                    'alter_text' => FALSE,
                    'text' => '',
                    'make_link' => FALSE,
                    'path' => '',
                    'absolute' => FALSE,
                    'external' => FALSE,
                    'replace_spaces' => FALSE,
                    'path_case' => 'none',
                    'trim_whitespace' => FALSE,
                    'alt' => '',
                    'rel' => '',
                    'link_class' => '',
                    'prefix' => '',
                    'suffix' => '',
                    'target' => '',
                    'nl2br' => FALSE,
                    'max_length' => 0,
                    'word_boundary' => TRUE,
                    'ellipsis' => TRUE,
                    'more_link' => FALSE,
                    'more_link_text' => '',
                    'more_link_path' => '',
                    'strip_tags' => FALSE,
                    'trim' => FALSE,
                    'preserve_tags' => '',
                    'html' => FALSE,
                  ],
                  'element_type' => '',
                  'element_class' => '',
                  'element_label_type' => '',
                  'element_label_class' => '',
                  'element_label_colon' => TRUE,
                  'element_wrapper_type' => '',
                  'element_wrapper_class' => '',
                  'element_default_classes' => TRUE,
                  'empty' => '-',
                  'hide_empty' => FALSE,
                  'empty_zero' => FALSE,
                  'hide_alter_empty' => TRUE,
                  'view_mode' => 'table',
                  'entity_type' => 'profile',
                  'plugin_id' => 'rendered_entity',
                ],
                'field_profile_organization' => [
                  'id' => 'field_profile_organization',
                  'table' => 'profile__field_profile_organization',
                  'field' => 'field_profile_organization',
                  'relationship' => 'profile',
                  'group_type' => 'group',
                  'admin_label' => '',
                  'label' => 'Organization',
                  'exclude' => FALSE,
                  'alter' => [
                    'alter_text' => FALSE,
                    'text' => '',
                    'make_link' => FALSE,
                    'path' => '',
                    'absolute' => FALSE,
                    'external' => FALSE,
                    'replace_spaces' => FALSE,
                    'path_case' => 'none',
                    'trim_whitespace' => FALSE,
                    'alt' => '',
                    'rel' => '',
                    'link_class' => '',
                    'prefix' => '',
                    'suffix' => '',
                    'target' => '',
                    'nl2br' => FALSE,
                    'max_length' => 0,
                    'word_boundary' => TRUE,
                    'ellipsis' => TRUE,
                    'more_link' => FALSE,
                    'more_link_text' => '',
                    'more_link_path' => '',
                    'strip_tags' => FALSE,
                    'trim' => FALSE,
                    'preserve_tags' => '',
                    'html' => FALSE,
                  ],
                  'element_type' => '',
                  'element_class' => '',
                  'element_label_type' => '',
                  'element_label_class' => '',
                  'element_label_colon' => TRUE,
                  'element_wrapper_type' => '',
                  'element_wrapper_class' => '',
                  'element_default_classes' => TRUE,
                  'empty' => '-',
                  'hide_empty' => FALSE,
                  'empty_zero' => FALSE,
                  'hide_alter_empty' => TRUE,
                  'click_sort_column' => 'value',
                  'type' => 'string',
                  'settings' => [
                    'link_to_entity' => FALSE,
                  ],
                  'group_column' => 'value',
                  'group_columns' => [],
                  'group_rows' => TRUE,
                  'delta_limit' => 0,
                  'delta_offset' => 0,
                  'delta_reversed' => FALSE,
                  'delta_first_last' => FALSE,
                  'multi_type' => 'separator',
                  'separator' => ', ',
                  'field_api_classes' => FALSE,
                  'plugin_id' => 'field',
                ],
                'field_request_message' => [
                  'id' => 'field_request_message',
                  'table' => 'event_enrollment__field_request_message',
                  'field' => 'field_request_message',
                  'relationship' => 'none',
                  'group_type' => 'group',
                  'admin_label' => '',
                  'label' => 'Message',
                  'exclude' => FALSE,
                  'alter' => [
                    'alter_text' => FALSE,
                    'text' => '',
                    'make_link' => FALSE,
                    'path' => '',
                    'absolute' => FALSE,
                    'external' => FALSE,
                    'replace_spaces' => FALSE,
                    'path_case' => 'none',
                    'trim_whitespace' => FALSE,
                    'alt' => '',
                    'rel' => '',
                    'link_class' => '',
                    'prefix' => '',
                    'suffix' => '',
                    'target' => '',
                    'nl2br' => FALSE,
                    'max_length' => 0,
                    'word_boundary' => TRUE,
                    'ellipsis' => TRUE,
                    'more_link' => FALSE,
                    'more_link_text' => '',
                    'more_link_path' => '',
                    'strip_tags' => FALSE,
                    'trim' => FALSE,
                    'preserve_tags' => '',
                    'html' => FALSE,
                  ],
                  'element_type' => '',
                  'element_class' => '',
                  'element_label_type' => '',
                  'element_label_class' => '',
                  'element_label_colon' => FALSE,
                  'element_wrapper_type' => '',
                  'element_wrapper_class' => '',
                  'element_default_classes' => TRUE,
                  'empty' => '',
                  'hide_empty' => FALSE,
                  'empty_zero' => FALSE,
                  'hide_alter_empty' => TRUE,
                  'click_sort_column' => 'value',
                  'type' => 'basic_string',
                  'settings' => [],
                  'group_column' => 'value',
                  'group_columns' => [],
                  'group_rows' => TRUE,
                  'delta_limit' => 0,
                  'delta_offset' => 0,
                  'delta_reversed' => FALSE,
                  'delta_first_last' => FALSE,
                  'multi_type' => 'separator',
                  'separator' => ', ',
                  'field_api_classes' => FALSE,
                  'plugin_id' => 'field',
                ],
                'field_request_or_invite_status' => [
                  'id' => 'field_request_or_invite_status',
                  'table' => 'event_enrollment__field_request_or_invite_status',
                  'field' => 'field_request_or_invite_status',
                  'relationship' => 'none',
                  'group_type' => 'group',
                  'admin_label' => '',
                  'label' => 'Request status',
                  'exclude' => FALSE,
                  'alter' => [
                    'alter_text' => FALSE,
                    'text' => '',
                    'make_link' => FALSE,
                    'path' => '',
                    'absolute' => FALSE,
                    'external' => FALSE,
                    'replace_spaces' => FALSE,
                    'path_case' => 'none',
                    'trim_whitespace' => FALSE,
                    'alt' => '',
                    'rel' => '',
                    'link_class' => '',
                    'prefix' => '',
                    'suffix' => '',
                    'target' => '',
                    'nl2br' => FALSE,
                    'max_length' => 0,
                    'word_boundary' => TRUE,
                    'ellipsis' => TRUE,
                    'more_link' => FALSE,
                    'more_link_text' => '',
                    'more_link_path' => '',
                    'strip_tags' => FALSE,
                    'trim' => FALSE,
                    'preserve_tags' => '',
                    'html' => FALSE,
                  ],
                  'element_type' => '',
                  'element_class' => '',
                  'element_label_type' => '',
                  'element_label_class' => '',
                  'element_label_colon' => TRUE,
                  'element_wrapper_type' => '',
                  'element_wrapper_class' => '',
                  'element_default_classes' => TRUE,
                  'empty' => '',
                  'hide_empty' => FALSE,
                  'empty_zero' => FALSE,
                  'hide_alter_empty' => TRUE,
                  'click_sort_column' => 'value',
                  'type' => 'list_default',
                  'settings' => [],
                  'group_column' => 'value',
                  'group_columns' => [],
                  'group_rows' => TRUE,
                  'delta_limit' => 0,
                  'delta_offset' => 0,
                  'delta_reversed' => FALSE,
                  'delta_first_last' => FALSE,
                  'multi_type' => 'separator',
                  'separator' => ', ',
                  'field_api_classes' => FALSE,
                  'plugin_id' => 'field',
                ],
                'created' => [
                  'id' => 'created',
                  'table' => 'event_enrollment_field_data',
                  'field' => 'created',
                  'relationship' => 'none',
                  'group_type' => 'group',
                  'admin_label' => '',
                  'label' => 'Requested on',
                  'exclude' => FALSE,
                  'alter' => [
                    'alter_text' => FALSE,
                    'text' => '',
                    'make_link' => FALSE,
                    'path' => '',
                    'absolute' => FALSE,
                    'external' => FALSE,
                    'replace_spaces' => FALSE,
                    'path_case' => 'none',
                    'trim_whitespace' => FALSE,
                    'alt' => '',
                    'rel' => '',
                    'link_class' => '',
                    'prefix' => '',
                    'suffix' => '',
                    'target' => '',
                    'nl2br' => FALSE,
                    'max_length' => 0,
                    'word_boundary' => TRUE,
                    'ellipsis' => TRUE,
                    'more_link' => FALSE,
                    'more_link_text' => '',
                    'more_link_path' => '',
                    'strip_tags' => FALSE,
                    'trim' => FALSE,
                    'preserve_tags' => '',
                    'html' => FALSE,
                  ],
                  'element_type' => '',
                  'element_class' => '',
                  'element_label_type' => '',
                  'element_label_class' => '',
                  'element_label_colon' => TRUE,
                  'element_wrapper_type' => '',
                  'element_wrapper_class' => '',
                  'element_default_classes' => TRUE,
                  'empty' => '',
                  'hide_empty' => FALSE,
                  'empty_zero' => FALSE,
                  'hide_alter_empty' => TRUE,
                  'click_sort_column' => 'value',
                  'type' => 'timestamp',
                  'settings' => [
                    'date_format' => 'social_long_date',
                    'custom_date_format' => '',
                    'timezone' => '',
                  ],
                  'group_column' => 'value',
                  'group_columns' => [],
                  'group_rows' => TRUE,
                  'delta_limit' => 0,
                  'delta_offset' => 0,
                  'delta_reversed' => FALSE,
                  'delta_first_last' => FALSE,
                  'multi_type' => 'separator',
                  'separator' => ', ',
                  'field_api_classes' => FALSE,
                  'entity_type' => 'event_enrollment',
                  'entity_field' => 'created',
                  'plugin_id' => 'field',
                ],
                'operations_1' => [
                  'id' => 'operations_1',
                  'table' => 'event_enrollment',
                  'field' => 'operations',
                  'relationship' => 'none',
                  'group_type' => 'group',
                  'admin_label' => '',
                  'label' => 'Operation',
                  'exclude' => FALSE,
                  'alter' => [
                    'alter_text' => FALSE,
                    'text' => '',
                    'make_link' => FALSE,
                    'path' => '',
                    'absolute' => FALSE,
                    'external' => FALSE,
                    'replace_spaces' => FALSE,
                    'path_case' => 'none',
                    'trim_whitespace' => FALSE,
                    'alt' => '',
                    'rel' => '',
                    'link_class' => '',
                    'prefix' => '',
                    'suffix' => '',
                    'target' => '',
                    'nl2br' => FALSE,
                    'max_length' => 0,
                    'word_boundary' => TRUE,
                    'ellipsis' => TRUE,
                    'more_link' => FALSE,
                    'more_link_text' => '',
                    'more_link_path' => '',
                    'strip_tags' => FALSE,
                    'trim' => FALSE,
                    'preserve_tags' => '',
                    'html' => FALSE,
                  ],
                  'element_type' => '',
                  'element_class' => '',
                  'element_label_type' => '',
                  'element_label_class' => '',
                  'element_label_colon' => TRUE,
                  'element_wrapper_type' => '',
                  'element_wrapper_class' => '',
                  'element_default_classes' => TRUE,
                  'empty' => '',
                  'hide_empty' => FALSE,
                  'empty_zero' => FALSE,
                  'hide_alter_empty' => TRUE,
                  'destination' => TRUE,
                  'entity_type' => 'event_enrollment',
                  'plugin_id' => 'entity_operations',
                ],
              ],
              'filters' => [
                'type' => [
                  'id' => 'type',
                  'table' => 'node_field_data',
                  'field' => 'type',
                  'relationship' => 'field_event',
                  'group_type' => 'group',
                  'admin_label' => '',
                  'operator' => 'in',
                  'value' => [
                    'event' => 'event',
                  ],
                  'group' => 1,
                  'exposed' => FALSE,
                  'expose' => [
                    'operator_id' => '',
                    'label' => '',
                    'description' => '',
                    'use_operator' => FALSE,
                    'operator' => '',
                    'identifier' => '',
                    'required' => FALSE,
                    'remember' => FALSE,
                    'multiple' => FALSE,
                    'remember_roles' => [
                      'authenticated' => 'authenticated',
                    ],
                    'reduce' => FALSE,
                    'operator_limit_selection' => FALSE,
                    'operator_list' => [],
                  ],
                  'is_grouped' => FALSE,
                  'group_info' => [
                    'label' => '',
                    'description' => '',
                    'identifier' => '',
                    'optional' => TRUE,
                    'widget' => 'select',
                    'multiple' => FALSE,
                    'remember' => FALSE,
                    'default_group' => 'All',
                    'default_group_multiple' => [],
                    'group_items' => [],
                  ],
                  'entity_type' => 'node',
                  'entity_field' => 'type',
                  'plugin_id' => 'bundle',
                ],
                'field_request_or_invite_status_value' => [
                  'id' => 'field_request_or_invite_status_value',
                  'table' => 'event_enrollment__field_request_or_invite_status',
                  'field' => 'field_request_or_invite_status_value',
                  'relationship' => 'none',
                  'group_type' => 'group',
                  'admin_label' => '',
                  'operator' => 'or',
                  'value' => [
                    '0',
                  ],
                  'group' => 1,
                  'exposed' => FALSE,
                  'expose' => [
                    'operator_id' => '',
                    'label' => '',
                    'description' => '',
                    'use_operator' => FALSE,
                    'operator' => '',
                    'operator_limit_selection' => FALSE,
                    'operator_list' => [],
                    'identifier' => '',
                    'required' => FALSE,
                    'remember' => FALSE,
                    'multiple' => FALSE,
                    'remember_roles' => [
                      'authenticated' => 'authenticated',
                    ],
                    '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,
                  'plugin_id' => 'list_field',
                ],
              ],
              'sorts' => [
                'created' => [
                  'id' => 'created',
                  'table' => 'event_enrollment_field_data',
                  'field' => 'created',
                  'relationship' => 'none',
                  'group_type' => 'group',
                  'admin_label' => '',
                  'order' => 'DESC',
                  'exposed' => FALSE,
                  'expose' => [
                    'label' => '',
                  ],
                  'granularity' => 'second',
                  'entity_type' => 'event_enrollment',
                  'entity_field' => 'created',
                  'plugin_id' => 'date',
                ],
                'field_request_or_invite_status_value' => [
                  'id' => 'field_request_or_invite_status_value',
                  'table' => 'event_enrollment__field_request_or_invite_status',
                  'field' => 'field_request_or_invite_status_value',
                  'relationship' => 'none',
                  'group_type' => 'group',
                  'admin_label' => '',
                  'order' => 'DESC',
                  'exposed' => FALSE,
                  'expose' => [
                    'label' => '',
                  ],
                  'plugin_id' => 'standard',
                ],
              ],
              'title' => 'Manage enrollment requests',
              'header' => [
                'area' => [
                  'id' => 'area',
                  'table' => 'views',
                  'field' => 'area',
                  'relationship' => 'none',
                  'group_type' => 'group',
                  'admin_label' => '',
                  'empty' => TRUE,
                  'tokenize' => TRUE,
                  'content' => [
                    'value' => '<h1 class="h4 section-title">[view:total-rows] Enroll request(s) to event: {{ arguments.nid }}</h1>',
                    'format' => 'full_html',
                  ],
                  'plugin_id' => 'text',
                ],
              ],
              'footer' => [],
              'empty' => [
                'area_text_custom' => [
                  'id' => 'area_text_custom',
                  'table' => 'views',
                  'field' => 'area_text_custom',
                  'relationship' => 'none',
                  'group_type' => 'group',
                  'admin_label' => '',
                  'empty' => TRUE,
                  'tokenize' => FALSE,
                  'content' => 'No one has requested to be enrolled for this event yet.',
                  'plugin_id' => 'text_custom',
                ],
              ],
              'relationships' => [
                'field_event' => [
                  'id' => 'field_event',
                  'table' => 'event_enrollment__field_event',
                  'field' => 'field_event',
                  'relationship' => 'none',
                  'group_type' => 'group',
                  'admin_label' => 'field_event: Content',
                  'required' => TRUE,
                  'plugin_id' => 'standard',
                ],
                'field_account' => [
                  'id' => 'field_account',
                  'table' => 'event_enrollment__field_account',
                  'field' => 'field_account',
                  'relationship' => 'none',
                  'group_type' => 'group',
                  'admin_label' => 'field_account: User',
                  'required' => FALSE,
                  'plugin_id' => 'standard',
                ],
                'profile' => [
                  'id' => 'profile',
                  'table' => 'users_field_data',
                  'field' => 'profile',
                  'relationship' => 'field_account',
                  'group_type' => 'group',
                  'admin_label' => 'Profile',
                  'required' => FALSE,
                  'entity_type' => 'user',
                  'plugin_id' => 'standard',
                ],
              ],
              'arguments' => [
                'nid' => [
                  'id' => 'nid',
                  'table' => 'node_field_data',
                  'field' => 'nid',
                  'relationship' => 'field_event',
                  'group_type' => 'group',
                  'admin_label' => '',
                  'default_action' => 'empty',
                  'exception' => [
                    'value' => 'all',
                    'title_enable' => FALSE,
                    'title' => 'All',
                  ],
                  'title_enable' => FALSE,
                  'title' => '',
                  'default_argument_type' => 'fixed',
                  'default_argument_options' => [
                    'argument' => '',
                  ],
                  'default_argument_skip_url' => FALSE,
                  'summary_options' => [
                    'base_path' => '',
                    'count' => TRUE,
                    'items_per_page' => 25,
                    'override' => FALSE,
                  ],
                  'summary' => [
                    'sort_order' => 'asc',
                    'number_of_records' => 0,
                    'format' => 'default_summary',
                  ],
                  'specify_validation' => FALSE,
                  'validate' => [
                    'type' => 'none',
                    'fail' => 'not found',
                  ],
                  'validate_options' => [],
                  'break_phrase' => FALSE,
                  'not' => FALSE,
                  'entity_type' => 'node',
                  'entity_field' => 'nid',
                  'plugin_id' => 'node_nid',
                ],
              ],
              'display_extenders' => [],
            ],
            'cache_metadata' => [
              'max-age' => -1,
              'contexts' => [
                'languages:language_content',
                'languages:language_interface',
                'url',
                'url.query_args',
              ],
              'tags' => [
                'config:core.entity_view_display.profile.profile.autocomplete_item',
                'config:core.entity_view_display.profile.profile.compact',
                'config:core.entity_view_display.profile.profile.compact_notification',
                'config:core.entity_view_display.profile.profile.compact_teaser',
                'config:core.entity_view_display.profile.profile.default',
                'config:core.entity_view_display.profile.profile.hero',
                'config:core.entity_view_display.profile.profile.search_index',
                'config:core.entity_view_display.profile.profile.small',
                'config:core.entity_view_display.profile.profile.small_teaser',
                'config:core.entity_view_display.profile.profile.statistic',
                'config:core.entity_view_display.profile.profile.table',
                'config:core.entity_view_display.profile.profile.teaser',
                'config:field.storage.event_enrollment.field_request_message',
                'config:field.storage.event_enrollment.field_request_or_invite_status',
                'config:field.storage.profile.field_profile_organization',
              ],
            ],
          ],
          'page_manage_enrollment_requests' => [
            'display_plugin' => 'page',
            'id' => 'page_manage_enrollment_requests',
            'display_title' => 'Page',
            'position' => 1,
            'display_options' => [
              'display_extenders' => [],
              'path' => 'node/%node/all-enrollment-requests',
              'menu' => [
                'type' => 'none',
                'title' => 'Manage requests',
                'description' => '',
                'expanded' => FALSE,
                'parent' => '',
                'weight' => 5,
                'context' => '0',
                'menu_name' => 'main',
              ],
            ],
            'cache_metadata' => [
              'max-age' => -1,
              'contexts' => [
                'languages:language_content',
                'languages:language_interface',
                'url',
                'url.query_args',
              ],
              'tags' => [
                'config:core.entity_view_display.profile.profile.autocomplete_item',
                'config:core.entity_view_display.profile.profile.compact',
                'config:core.entity_view_display.profile.profile.compact_notification',
                'config:core.entity_view_display.profile.profile.compact_teaser',
                'config:core.entity_view_display.profile.profile.default',
                'config:core.entity_view_display.profile.profile.hero',
                'config:core.entity_view_display.profile.profile.search_index',
                'config:core.entity_view_display.profile.profile.small',
                'config:core.entity_view_display.profile.profile.small_teaser',
                'config:core.entity_view_display.profile.profile.statistic',
                'config:core.entity_view_display.profile.profile.table',
                'config:core.entity_view_display.profile.profile.teaser',
                'config:field.storage.event_enrollment.field_request_message',
                'config:field.storage.event_enrollment.field_request_or_invite_status',
                'config:field.storage.profile.field_profile_organization',
              ],
            ],
          ],
        ],
      ],
      // Message templates.
      'message.template.request_event_enrollment' => [
        'langcode' => 'en',
        'status' => TRUE,
        'dependencies' => [
          'module' => [
            'activity_logger',
          ],
        ],
        'third_party_settings' => [
          'activity_logger' => [
            'activity_bundle_entities' => [
              'event_enrollment-event_enrollment' => 'event_enrollment-event_enrollment',
            ],
            'activity_action' => 'create_entitiy_action',
            'activity_context' => 'event_request_activity_context',
            'activity_destinations' => [
              'notifications' => 'notifications',
              'email' => 'email',
            ],
            'activity_create_direct' => FALSE,
            'activity_aggregate' => FALSE,
            'activity_entity_condition' => '',
          ],
        ],
        'template' => 'request_event_enrollment',
        'label' => 'Request event enrollment',
        'description' => 'A user request an enrollment for event',
        'text' => [
          [
            'value' => '<p><a href="[social_event:enrolled_event_url]">[social_event:enrolled_user]</a> has requested enrollment to the event [social_event:event_iam_organizing] you are organizing</p>',
            'format' => 'full_html',
          ],
          [
            'value' => '<p><a href="[social_event:enrolled_event_url]">[social_event:enrolled_user]</a> has requested enrollment to the event [social_event:event_iam_organizing] you are organizing</p>',
            'format' => 'full_html',
          ],
          [
            'value' => '<p><a href="[social_event:enrolled_event_url]">[social_event:enrolled_user]</a> has requested enrollment to the event [social_event:event_iam_organizing] you are organizing</p>',
            'format' => 'full_html',
          ],
        ],
        'settings' => [
          'token options' => [
            'clear' => FALSE,
            'token replace' => TRUE,
          ],
          'purge_override' => FALSE,
          'purge_methods' => [],
        ],
      ],
      'message.template.event_request_approved' => [
        'langcode' => 'en',
        'status' => TRUE,
        'dependencies' => [
          'module' => [
            'activity_logger',
          ],
        ],
        'third_party_settings' => [
          'activity_logger' => [
            'activity_bundle_entities' => [
              'event_enrollment-event_enrollment' => 'event_enrollment-event_enrollment',
            ],
            'activity_action' => 'update_entity_action',
            'activity_context' => 'event_request_activity_context',
            'activity_destinations' => [
              'notifications' => 'notifications',
              'email' => 'email',
            ],
            'activity_create_direct' => TRUE,
            'activity_aggregate' => FALSE,
            'activity_entity_condition' => '',
          ],
        ],
        'template' => 'event_request_approved',
        'label' => 'Request approved event enrollment',
        'description' => 'The request to enroll to an enrollment is approved',
        'text' => [
          [
            'value' => '<p><a href="[message:author:url:absolute]">[message:author:display-name]</a> approved your request to enroll for the event [social_event:event_iam_organizing]</p>',
            'format' => 'full_html',
          ],
          [
            'value' => '<p><a href="[message:author:url:absolute]">[message:author:display-name]</a> approved your request to enroll for the event [social_event:event_iam_organizing]</p>',
            'format' => 'full_html',
          ],
          [
            'value' => '<p><a href="[message:author:url:absolute]">[message:author:display-name]</a> approved your request to enroll for the event [social_event:event_iam_organizing]</p>',
            'format' => 'full_html',
          ],
        ],
        'settings' => [
          'token options' => [
            'clear' => FALSE,
            'token replace' => TRUE,
          ],
          'purge_override' => FALSE,
          'purge_methods' => [],
        ],
      ],
    ];

    // Count the amount we need to add to cover batching..
    $sandbox['total'] = count($sandbox['configs']);
    $sandbox['current'] = 0;
  }
  $names = array_keys($sandbox['configs']);
  $name = $names[$sandbox['current']++];
  $data = $sandbox['configs'][$name];
  $parts = explode('.', $name);
  switch ($parts[0] . '.' . $parts[1]) {
    case 'field.storage':
      $entity_type = \Drupal::service('config.manager')
        ->getEntityTypeIdByName($name);

      /** @var \Drupal\Core\Config\Entity\ConfigEntityStorageInterface $storage */
      $storage = \Drupal::entityTypeManager()
        ->getStorage($entity_type);
      $entity = $storage
        ->createFromStorageRecord($data);
      $entity
        ->save();
      break;
    case 'field.field':
      $field_config = FieldConfig::loadByName($parts[2], $parts[3], $parts[4]);
      if ($field_config instanceof FieldConfigInterface) {
        $field_config
          ->setDescription($data);
      }
      else {
        $field_config = FieldConfig::create($data);
      }
      $field_config
        ->save();
      break;
    default:

      // Insert newly created config in the storage.
      \Drupal::service('config.storage')
        ->write($name, $data);
  }
  $sandbox['#finished'] = $sandbox['current'] / $sandbox['total'];
}