function domain_warning_check in Domain Access 7.3
Same name and namespace in other branches
- 5 domain.module \domain_warning_check()
- 6.2 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.
Parameters
$form_id: The form_id of the active form.
Return value
No return value. Set the proper message to the user.
1 call to domain_warning_check()
- domain_form_alter in ./
domain.module - Implements hook_form_alter().
File
- ./
domain.module, line 3261 - Core module functions for the Domain Access suite.
Code
function domain_warning_check($form_id) {
$_warning =& drupal_static(__FUNCTION__);
// 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('domain_warning');
drupal_alter('domain_warnings', $forms);
if ($form_id == 'domain_batch_form' || arg(2) != 'domain' && in_array($form_id, array_keys($forms))) {
$default = domain_default();
$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);
$message = '';
if ($_domain['domain_id'] != $default['domain_id']) {
$message = ' ' . t('and <a href="!url">may need to be entered from !domain</a>', array(
'!url' => $_path,
'!domain' => $default['subdomain'],
));
}
else {
$link_text = '';
}
drupal_set_message(t('This form submits changes to your default
configuration!message. !link', array(
'!message' => $message,
'!link' => $link_text,
)), 'warning', FALSE);
}
$_warning = TRUE;
}
}