You are here

function content_access_set_settings in Content Access 8

Same name and namespace in other branches
  1. 5 content_access.module \content_access_set_settings()
  2. 6 content_access.module \content_access_set_settings()
  3. 7 content_access.module \content_access_set_settings()

Save content_access settings of a content type.

2 calls to content_access_set_settings()
ContentAccessAdminSettingsForm::submitForm in src/Form/ContentAccessAdminSettingsForm.php
Form submission handler.
content_access_node_type_update in ./content_access.module
Implements hook_node_type_update().

File

./content_access.module, line 241
Content access module file.

Code

function content_access_set_settings($settings, $type_name) {
  $config = \Drupal::configFactory()
    ->getEditable('content_access.settings');

  // Do not store default values so we do not have to care about syncing our
  // settings with the permissions.
  foreach (content_access_get_setting_defaults($type_name) as $setting => $default_value) {
    if (isset($settings[$setting]) && $settings[$setting] == $default_value) {
      unset($settings[$setting]);
    }
  }
  $config
    ->set('content_access_node_type.' . $type_name, serialize($settings));
  $config
    ->save();
}