function _disclaimer_build_content in Disclaimer 7
Generate disclaimer content.
Parameters
bool $hidden: Default style dsplay hidden.
Return value
string Html content rendered.
2 calls to _disclaimer_build_content()
- disclaimer_admin_settings in ./
disclaimer.admin.inc - Admin settings form for Disclaimer.
- disclaimer_page_build in ./
disclaimer.module - Implements hook_page_build().
File
- ./
disclaimer.module, line 117 - Create and show disclaimer for your site.
Code
function _disclaimer_build_content($hidden = TRUE) {
// Load cookie library.
drupal_add_library('system', 'jquery.cookie');
// Build renderable array.
$render_array = array(
'#theme' => 'disclaimer',
'#hidden' => $hidden,
);
$exit_url = variable_get('disclaimer_exit_url', 'http://www.google.com');
$enter_url = variable_get('disclaimer_enter_url', '');
// Build button form depending settings.
if (variable_get('disclaimer_action_type', 'text') == 'image') {
$enter = _disclaimer_render_image();
$exit = _disclaimer_render_image('exit');
}
else {
$enter = variable_get('disclaimer_enter_txt', t('ENTER'));
$exit = variable_get('disclaimer_exit_txt', t('EXIT'));
}
// Check age form.
if (variable_get('disclaimer_age_form', 0) == 1) {
$age_form = drupal_get_form('disclaimer_age_form');
$render_array['#age_form'] = render($age_form);
}
// Enter redirect or not.
if ($enter_url) {
$enter = l($enter, $enter_url, array(
'html' => TRUE,
'attributes' => array(
'id' => 'disclaimer_enter',
),
));
}
else {
$enter = '<a href="#" id="disclaimer_enter">' . $enter . '</a>';
}
$exit = l($exit, $exit_url, array(
'html' => TRUE,
));
// Show main content.
$render_array['#content'] = _disclaimer_render_content();
// Buttons render.
$render_array['#enter_link'] = $enter;
$render_array['#exit_link'] = $exit;
// Footer content.
$render_array['#footer'] = _disclaimer_render_content('footer');
// Add minimal css.
if (variable_get('disclaimer_css', 1) == 1) {
drupal_add_css(drupal_get_path('module', 'disclaimer') . '/disclaimer.css');
}
// Add settings.
_disclaimer_js_settings();
// Add js.
drupal_add_js(drupal_get_path('module', 'disclaimer') . '/disclaimer.js', array(
'scope' => 'footer',
));
return render($render_array);
}