Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
My Problem :
I want to display the number of results (the total count) of a view whose is embed in each node, but the views depends of an argument (node : Id). My question : How to pass the argument. Actually, the result is always "0". How can I select the argument of my view that I want to pass ?
What I actually put in the COMPUTED CODE FIELD :
$view_name = 'doc_bloc_document_cite_dans';
$display_id = 'Bloc';
$view_args = array();
$view = views_get_view($view_name);
$view -> execute_display($display_id, $view_args);
$count = count($view->result);
$node_field[0]['value'] = $count;
Comments
Comment #1
vstmusic CreditAttribution: vstmusic commentedWith thi code :
arguments of the nodes 1, 2, 3, 4 ,5, 6, 7, 8, 9 are passed in the view, but after these numbers, arguments passe only the first number. for example: For the ID node 51, the argument passed is 5 and not 51.
Can you help me to correctly pass the enterely argument number ?
Thanks for your help !!!
Comment #2
mmjvb CreditAttribution: mmjvb as a volunteer commented