function google_qr_code_contents in Google QR Code Generator 7
A custom module-defined block content function.
1 call to google_qr_code_contents()
- google_qr_code_block_view in ./
google_qr_code.module - Google_qr_code Implements hook_block_view().
File
- ./
google_qr_code.module, line 47 - Provides block using Google Charts to render QR code.
Code
function google_qr_code_contents($which_block) {
switch ($which_block) {
case 'qr_code':
$render_type = variable_get('google_qr_code_when_show', "on_pageload");
if ($render_type == 'on_click') {
$output = l(t('Click To Render QR Code'), '', array(
'attributes' => array(
'class' => 'inner',
),
));
}
else {
$google_qr_current_url = url(current_path(), array(
'absolute' => TRUE,
));
$google_qr_image_url = "https://chart.googleapis.com/chart?chs=" . variable_get('google_qr_code_width', '250') . "x" . variable_get('google_qr_code_height', '250') . "&cht=qr&chl=" . $google_qr_current_url . '&chld=H|0';
$google_qr_alt = t('QR Code for @url', array(
'@url' => $google_qr_current_url,
));
$output = theme('image', array(
'path' => $google_qr_image_url,
'alt' => $google_qr_alt,
'attributes' => array(
'class' => 'googleQRcode',
),
));
}
return array(
'#markup' => '<div id="google-qr-code">' . $output . '</div>',
'#attached' => array(
'js' => array(
drupal_get_path('module', 'google_qr_code') . '/google.qrcode-execute.js',
),
),
);
}
}