You are here

function content_access_get_settings in Content Access 8

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

Return content_access' settings.

Parameters

string $setting: One of the content_access_available_settings(), e.g. 'view' or 'per_node'. If 'all' is passed, all available settings are returned.

string $type_name: The name of the content type to return settings for.

Return value

mixed The value of the given setting or an array of all settings.

13 calls to content_access_get_settings()
ActionCommonTrait::actionUser in src/Plugin/RulesAction/ActionCommonTrait.php
Process Rule's param, and grant by the passed operation.
ContentAccessAdminSettingsForm::buildForm in src/Form/ContentAccessAdminSettingsForm.php
Form constructor.
ContentAccessAdminSettingsForm::submitForm in src/Form/ContentAccessAdminSettingsForm.php
Form submission handler.
ContentAccessNodePageAccessCheck::access in src/Access/ContentAccessNodePageAccessCheck.php
ContentAccessPageForm::buildForm in src/Form/ContentAccessPageForm.php
Form constructor.

... See full list

File

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

Code

function content_access_get_settings($setting, $type_name) {
  $config = \Drupal::configFactory()
    ->getEditable('content_access.settings');
  $settings = unserialize($config
    ->get('content_access_node_type.' . $type_name));
  if (empty($settings)) {
    $settings = [];
  }
  $settings += content_access_get_setting_defaults($type_name);
  if ($setting == 'all') {
    return $settings;
  }
  return isset($settings[$setting]) ? $settings[$setting] : NULL;
}