Problem/Motivation
In Drupal 7 there are below options to print widgets, results etc and all is mentioned in documentation. It will be great help to users to add such in 8 documentation as well.
<?php
print theme('rate_button', array(
'text' => $links[0]['text'],
'href' => $links[0]['href'],
'class' => "extra-class")
);
?>
<?php print $results['rating']; ?>
print rate_embed($node, 'NAME', RATE_FULL);
print rate_embed($node, 'NAME', RATE_COMPACT);
print rate_embed($node, 'NAME', RATE_DISABLED);
print rate_embed($node, 'NAME', RATE_CLOSED);
How we can do similar in Drupal 8 twig template of node type.
Thanks!
Comments
Comment #2
jas1988 commentedComment #3
jordik commentedThis functionality is not ported from D7.
And for now I do not see a necessity for it given the current functionality.
What is your use case for needing this in D8?
Comment #4
jas1988 commentedUse-case examples:
Is there any way currently to print rate widgets in node template files or this is also related to port ?
In 7 it was :
rate_generate_widget('1', 'node', $node->nid, RATE_FULL, TRUE, FALSE, NULL);Comment #5
jordik commentedThe first bullet you can achieve with attaching the widget to your custom content type in the widget settings.
Second and third - with views. If you really need to "print" a widget, you will need to call the rate.vote_widget_base service and invoke the getFrom method. Check rate.module how it is done. You will have to take care about the form container and attaching the libraries yourself.
So I would friendly advise you to stick to the standard methods.
Comment #6
jas1988 commentedThanks for suggestion, I will look into code files. ( using view is not an option as completely custom functionality in my form including lot more fields/features etc )
Comment #7
jordik commented