Commit cbb1b5f9 authored by zhgenti's avatar zhgenti

Issue #506936 by Zhgenti: Render API is used instead of just theming function....

Issue #506936 by Zhgenti: Render API is used instead of just theming function. plus1_get_cleared_destination() has been added. Code style corrections.
parent b4aa1ae0
......@@ -35,46 +35,6 @@ div.plus1-widget .plus1-undo-vote a {
margin-bottom: 10px;
}
.plus1-comment-abuse {
background: url(images/abuse.png) no-repeat 0 0;
padding-left: 18px;
padding-top: 1px;
}
.plus1-comment-abuse-checked {
background: url(images/abuse.png) no-repeat 0 -16px;
padding-left: 18px;
padding-top: 1px;
}
a.plus1-comment-abuse:hover {
background: url(images/abuse.png) no-repeat 0 -16px;
}
a.plus1-comment-abuse-checked:hover {
background: url(images/abuse.png) no-repeat 0 0;
}
.plus1-comment-vote {
background: url(images/thumbs_up.png) no-repeat 0 0;
padding: 2px 0 0 18px;
}
.plus1-comment-vote-checked {
background: url(images/thumbs_up.png) no-repeat 0 -20px;
padding: 2px 0 0 18px;
}
a.plus1-comment-vote:hover {
background: url(images/thumbs_up.png) no-repeat 0 -20px;
}
a.plus1-comment-vote-checked:hover {
background: url(images/thumbs_up.png) no-repeat 0 0px;
}
.plus1-comment-score {
color: black;
padding-right: 2px;
......
This diff is collapsed.
......@@ -49,34 +49,26 @@ function template_preprocess_plus1_widget(&$variables) {
// User is eligible to vote.
$variables['widget_message'] = l($vote_text, $vote_link, array('query' => $link_query, 'attributes' => array('class' => array('plus1-link'))));
}
// Load the JavaScript and CSS files.
// You can disable loading of these files and create your own instead of them.
if (variable_get('plus1_add_js', 1)) {
drupal_add_js(drupal_get_path('module', 'plus1') . '/jquery.plus1.js');
}
if (variable_get('plus1_add_css', 1)) {
drupal_add_css(drupal_get_path('module', 'plus1') . '/plus1.css');
}
}
/**
* Theming function for json response.
* @param $variables
* @return array
* Returns an array of variables which will be send back to browser, after ajax request.
* @see plus1_vote() and plus1_undo_vote()
*
* Returns an array of variables which will be send back to browser, after ajax request.
* @see plus1_vote(), plus1_undo_vote()
*/
function theme_plus1_json_response($variables) {
switch ($variables['entity_type']) {
case 'node':
return array('widget' => plus1_node_jquery_widget($variables['entity_id'], $variables['tag']));
return array('widget' => drupal_render(plus1_build_node_jquery_widget($variables['entity_id'], $variables['tag'])));
break;
case 'taxonomy_term':
return array('widget' => plus1_taxonomy_term_jquery_widget($variables['entity_id'], $variables['tag']));
return array('widget' => drupal_render(plus1_build_taxonomy_term_jquery_widget($variables['entity_id'], $variables['tag'])));
break;
case 'comment':
return array('widget' => plus1_comment_jquery_widget($variables['entity_id'], $variables['tag']));
return array('widget' => drupal_render(plus1_build_comment_jquery_widget($variables['entity_id'], $variables['tag'])));
break;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment