function domain_warning_check in Domain Access 6.2
Same name and namespace in other branches
- 5 domain.module \domain_warning_check()
- 7.3 domain.module \domain_warning_check()
- 7.2 domain.module \domain_warning_check()
Sets a message to the site admin.
If our module changes $conf settings, they may be reflected on admin pages when we don't want them to be.
1 call to domain_warning_check()
- domain_form_alter in ./
domain.module - Implement hook_form_alter()
File
- ./
domain.module, line 2585 - Core module functions for the Domain Access suite.
Code
function domain_warning_check($form_id) {
static $_warning;
// If $_POST is set, we are submitting the form and should not set a message.
if (empty($_POST) && empty($_warning)) {
global $_domain;
// Add the list of forms
$forms = array();
$forms = module_invoke_all('domainwarnings');
drupal_alter('domain_warnings', $forms);
// Catch the API change.
foreach ($forms as $key => $value) {
if (is_numeric($key)) {
$forms[$value] = '';
unset($forms[$key]);
}
}
if ($form_id == 'domain_batch_form' || arg(2) != 'domain' && in_array($form_id, array_keys($forms))) {
$default = domain_default();
if ($_domain['domain_id'] == $default['domain_id']) {
return;
}
$link_text = '';
$link = isset($forms[$form_id]) ? $forms[$form_id] : NULL;
if (!empty($link)) {
$elements = array();
foreach ($_domain as $key => $value) {
if (!is_array($value)) {
$elements[$key] = $value;
}
}
$replace = explode('|', '%' . implode('|%', array_keys($elements)));
$values = explode('|', implode('|', $elements));
$link = str_replace($replace, $values, $link);
$link_text = t('You may submit changes to the current domain at <a href="!url">%link</a>.', array(
'!url' => url($link),
'%link' => $link,
));
}
$_path = domain_get_uri($default);
drupal_set_message(t('This form submits changes to your primary domain and <a href="!url">may need to be entered from !domain</a>. !link', array(
'#this' => $_domain['subdomain'],
'!url' => $_path,
'!domain' => $default['subdomain'],
'!link' => $link_text,
)), 'warning', FALSE);
}
$_warning = TRUE;
}
}