function _enrolments_export_plugin_access in Open Social 8.8
Same name and namespace in other branches
- 8.9 modules/social_features/social_event/modules/social_event_an_enroll_enrolments_export/social_event_an_enroll_enrolments_export.install \_enrolments_export_plugin_access()
- 10.3.x modules/social_features/social_event/modules/social_event_an_enroll_enrolments_export/social_event_an_enroll_enrolments_export.install \_enrolments_export_plugin_access()
- 10.0.x modules/social_features/social_event/modules/social_event_an_enroll_enrolments_export/social_event_an_enroll_enrolments_export.install \_enrolments_export_plugin_access()
- 10.1.x modules/social_features/social_event/modules/social_event_an_enroll_enrolments_export/social_event_an_enroll_enrolments_export.install \_enrolments_export_plugin_access()
- 10.2.x modules/social_features/social_event/modules/social_event_an_enroll_enrolments_export/social_event_an_enroll_enrolments_export.install \_enrolments_export_plugin_access()
Sets the access for the export plugins.
Parameters
bool $reverse: Flip the keys and value of the mapping plugins.
3 calls to _enrolments_export_plugin_access()
- social_event_an_enroll_enrolments_export_install in modules/
social_features/ social_event/ modules/ social_event_an_enroll_enrolments_export/ social_event_an_enroll_enrolments_export.install - Implements hook_install().
- social_event_an_enroll_enrolments_export_uninstall in modules/
social_features/ social_event/ modules/ social_event_an_enroll_enrolments_export/ social_event_an_enroll_enrolments_export.install - Implements hook_uninstall().
- social_event_an_enroll_enrolments_export_update_8001 in modules/
social_features/ social_event/ modules/ social_event_an_enroll_enrolments_export/ social_event_an_enroll_enrolments_export.install - Set the enroll export plugins access based on their counterpart access.
File
- modules/
social_features/ social_event/ modules/ social_event_an_enroll_enrolments_export/ social_event_an_enroll_enrolments_export.install, line 50 - Install, update and uninstall functions for the AN Enroll Export module.
Code
function _enrolments_export_plugin_access($reverse = FALSE) {
// Get the plugin mapping.
$mapping = _enrolments_export_plugin_mapping($reverse);
$config = \Drupal::getContainer()
->get('config.factory')
->getEditable('social_user_export.settings');
$plugins = $config
->get('plugins');
// We now need to go through the plugins and add the plugin that should be
// active based on the currently active plugins (either existing or enroll
// plugins).
foreach ($plugins as $key => $value) {
foreach ($mapping as $existing_plugin => $new_plugin) {
if ($key === $existing_plugin && !empty($value)) {
$plugins[$new_plugin] = $new_plugin;
}
}
}
// Set the default export plugins normal users can use.
$config
->set('plugins', $plugins)
->save();
}