function theme_fivestar_preview in Fivestar 7.2
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()
- 6 fivestar.module \theme_fivestar_preview()
File
- includes/
fivestar.theme.inc, line 65 - Provides the theming functions for fivestar.
Code
function theme_fivestar_preview($variables) {
extract($variables, EXTR_SKIP);
$values = array(
'average' => 50,
'user' => 80,
'count' => 20,
);
$settings = array(
'stars' => $stars,
'allow_clear' => $unvote,
'allow_revote' => $revote,
'allow_ownvote' => $ownvote,
'style' => $style,
'text' => $text,
'title' => $title,
'autosubmit' => FALSE,
'tag' => 'vote',
);
$form = drupal_get_form('fivestar_custom_widget', $values, $settings);
$form = drupal_render($form);
// This regex is sadly necessary because having duplicate form_tokens or
// form_id elements can cause the content type form to choke. Forms inside of
// forms is also frowned upon, so this removes the wrapping form tag as well.
$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;
}