function domain_default_node_access_settings in Domain Access 7.3
Returns default node access settings for new content.
Usually, you may use this function in forms, and when you look for default access settings in general. Use domain_get_node_defaults() when you need an array for a node object.
Parameters
$type: The node type (like 'article').
Return value
An array of default settings.
See also
4 calls to domain_default_node_access_settings()
- DomainSettingsTest::testDomainContentSettings in tests/
domain.test - domain_form_node_type_form_alter in ./
domain.module - Implements hook_form_FORM_ID_alter().
- domain_get_node_defaults in ./
domain.module - Returns default node access settings, ready for a node object.
- domain_nodes_form in ./
domain.admin.inc - FormAPI to set default domain settings per content type.
File
- ./
domain.module, line 4329 - Core module functions for the Domain Access suite.
Code
function domain_default_node_access_settings($type) {
// We need to know if there are user-defined settings.
// If so, we get an array, though it could be empty.
$settings = variable_get('domain_node_' . $type, NULL);
// Append default behavior, if there are no user-defined settings.
if (is_null($settings)) {
// Assign the currently active domain.
$settings = array(
0 => 'DOMAIN_ACTIVE',
);
// And publish to all domains when rule allows it.
if (DOMAIN_INSTALL_RULE) {
$settings[] = 'DOMAIN_ALL';
}
}
elseif (isset($settings['DOMAIN_ALL'])) {
$old_settings = $settings;
// Reset settings array and fill it with correct pattern.
$settings = array();
foreach ($old_settings as $key => $value) {
// Machine_name could be of value 0. The second condition covers this special case.
if ($value !== 0 || $key === 0 && $value === 0) {
$settings[] = $value;
}
}
}
return $settings;
}