function hijri_preprocess_comment in Hijri 7
Same name and namespace in other branches
- 8.2 hijri.module \hijri_preprocess_comment()
- 8 hijri.module \hijri_preprocess_comment()
- 3.0.x hijri.module \hijri_preprocess_comment()
- 1.0.x hijri.module \hijri_preprocess_comment()
Process variables for comment.tpl.php.
See also
File
- ./
hijri.module, line 354 - This module convert to Hijri date in nodes,comments and a block.
Code
function hijri_preprocess_comment(&$variables) {
$comment = $variables['elements']['#comment'];
$node = $variables['elements']['#node'];
$variables['comment'] = $comment;
$variables['author'] = theme('username', array(
'account' => $comment,
));
$variables['created'] = format_date($comment->created);
$correction = isset($node->field_hijri_correction[$node->language][0]['value']) ? $node->field_hijri_correction[$node->language][0]['value'] : 0;
switch (variable_get('hijri_comment_display')) {
case 'full':
case 'long':
case 'medium':
case 'short':
$format = hijri_format_date($node->created, variable_get('hijri_comment_display'), NULL, $correction);
break;
default:
$format = $variables['created'];
break;
}
$node_types = variable_get('hijri_types', array());
if ((string) $node_types[$node->type] == $node->type) {
$variables['submitted'] = t('Submitted by !username on !datetime', array(
'!username' => $variables['author'],
'!datetime' => $format,
));
$variables['created'] = $format;
}
}