function theme_fivestar_preview in Fivestar 6
Same name and namespace in other branches
- 8 includes/fivestar.theme.inc \theme_fivestar_preview()
- 5 fivestar.module \theme_fivestar_preview()
- 6.2 includes/fivestar.admin.inc \theme_fivestar_preview()
- 7.2 includes/fivestar.theme.inc \theme_fivestar_preview()
3 theme calls to theme_fivestar_preview()
- fivestar_comment_form_alter in ./fivestar_comment.module
- Form alter specification for comments.
- fivestar_form_alter in ./fivestar.module
- Implementation of hook_form_alter().
- fivestar_preview in ./fivestar.module
- Callback function for fivestar/preview/node. Outputs a JSON page containing
a Fivestar preview of a node rating widget.
File
- ./fivestar.module, line 642
- A simple n-star voting widget, usable in other forms.
Code
function theme_fivestar_preview($style = NULL, $text = NULL, $stars = NULL, $unvote = NULL, $title = NULL, $feedback_enable = TRUE, $labels_enable = TRUE, $labels = array()) {
$values = array(
'average' => 50,
'user' => 80,
'count' => 20,
);
$settings = array(
'stars' => $stars,
'allow_clear' => $unvote,
'style' => $style,
'text' => $text,
'title' => $title,
'autosubmit' => FALSE,
'feedback_enable' => $feedback_enable,
'labels_enable' => $labels_enable,
'labels' => $labels,
);
$form = drupal_get_form('fivestar_custom_widget', $values, $settings);
$form = str_replace(array(
'<form',
'</form>',
), array(
'<div',
'</div>',
), $form);
$form = preg_replace('/( method=".*?")|( action=".*?")|(<input.*?name="(form_token|form_id|destination|form_build_id)".*?\\/>)/', '', $form);
return $form;
}