function samlauth_install in SAML Authentication 8.3
Same name and namespace in other branches
- 4.x samlauth.install \samlauth_install()
Import view for authmap entries.
File
- ./
samlauth.install, line 18 - Update and uninstall functions for the samlauth module.
Code
function samlauth_install($is_syncing = FALSE) {
// It's strange to me that this would be explicitly necessary, and all docs
// I read suggest it should happen automatically, but I can't seem to
// simulate a module install procedure where it does happen automatically.
// (Code is a copy from samlauth_post_update_add_view_samlauth_map().)
if (!$is_syncing && \Drupal::moduleHandler()
->moduleExists('views') && !View::load('samlauth_map')) {
$module_path = \Drupal::moduleHandler()
->getModule('samlauth')
->getPath();
$file_storage = new FileStorage($module_path . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY);
$view = \Drupal::entityTypeManager()
->getStorage('view')
->create($file_storage
->read('views.view.samlauth_map'));
$view
->save();
}
}