[views] comment utiliser les arguments dans mon cas ?

Information importante

En raison d'un grand nombre d'inscriptions de spammers sur notre site, polluant sans relache notre forum, nous suspendons la création de compte via le formulaire de "sign up".

Il est néanmoins toujours possible de devenir adhérent•e en faisant la demande sur cette page, rubrique "Inscription" : https://www.drupal.fr/contact


De plus, le forum est désormais "interdit en écriture". Il n'est plus autorisé d'y écrire un sujet/billet/commentaire.

Pour contacter la communauté, merci de rejoindre le slack "drupalfrance".

Si vous voulez contacter le bureau de l'association, utilisez le formulaire disponible ici, ou envoyez-nous un DM sur twitter.

bonjour
je souhaiterais faire une vue pour un site dont je m'occupe et qui gere des spectacles de theatre de rue.

j'ai des "compagnies" de theatre qui ont des "spectacles" et font des "representations" dans des "lieux"

j'utilise pour chaque entite un type de noeud qui sont lies par "node reference" de cck

mon but est de lister les representations, spectacles, lieux en dessous du noeud de la compagnie.
j'affiche la compagnie et je souhaiterais voir tout ca en dessous.

ci joint un dessin pour essayer de comprendre ce que je souhaite faire.

j'arrive pas a utiliser les arguments pour cela, meme si je mets le numero de node, ca me repond aucune entree.

actuellement, voici ma vue :

<?php
$view
= new view;
$view->name = 'representations_par_compagnies';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Paramètres par défaut', 'default');
$handler->override_option('relationships', array(
 
'field_lieu_nid' => array(
   
'label' => 'lieu',
   
'required' => 0,
   
'delta' => -1,
   
'id' => 'field_lieu_nid',
   
'table' => 'node_data_field_lieu',
   
'field' => 'field_lieu_nid',
   
'relationship' => 'none',
  ),
 
'field_spectacle_nid' => array(
   
'label' => 'spectacle',
   
'required' => 0,
   
'delta' => '-1',
   
'id' => 'field_spectacle_nid',
   
'table' => 'node_data_field_spectacle',
   
'field' => 'field_spectacle_nid',
   
'relationship' => 'none',
  ),
 
'field_compagnie_nid' => array(
   
'label' => 'Compagnie',
   
'required' => 0,
   
'delta' => '-1',
   
'id' => 'field_compagnie_nid',
   
'table' => 'node_data_field_compagnie',
   
'field' => 'field_compagnie_nid',
   
'relationship' => 'field_spectacle_nid',
  ),
));
$handler->override_option('fields', array(
 
'title' => array(
   
'label' => '',
   
'alter' => array(
     
'alter_text' => 0,
     
'text' => '',
     
'make_link' => 0,
     
'path' => '',
     
'link_class' => '',
     
'alt' => '',
     
'prefix' => '',
     
'suffix' => '',
     
'target' => '',
     
'help' => '',
     
'trim' => 0,
     
'max_length' => '',
     
'word_boundary' => 1,
     
'ellipsis' => 1,
     
'strip_tags' => 0,
     
'html' => 0,
    ),
   
'empty' => '',
   
'hide_empty' => 0,
   
'empty_zero' => 0,
   
'link_to_node' => 1,
   
'exclude' => 0,
   
'id' => 'title',
   
'table' => 'node',
   
'field' => 'title',
   
'relationship' => 'none',
  ),
 
'type' => array(
   
'label' => 'Type',
   
'alter' => array(
     
'alter_text' => 0,
     
'text' => '',
     
'make_link' => 0,
     
'path' => '',
     
'link_class' => '',
     
'alt' => '',
     
'prefix' => '',
     
'suffix' => '',
     
'target' => '',
     
'help' => '',
     
'trim' => 0,
     
'max_length' => '',
     
'word_boundary' => 1,
     
'ellipsis' => 1,
     
'strip_tags' => 0,
     
'html' => 0,
    ),
   
'empty' => '',
   
'hide_empty' => 0,
   
'empty_zero' => 0,
   
'link_to_node' => 0,
   
'exclude' => 1,
   
'id' => 'type',
   
'table' => 'node',
   
'field' => 'type',
   
'relationship' => 'none',
  ),
 
'title_1' => array(
   
'label' => 'Lieu',
   
'alter' => array(
     
'alter_text' => 0,
     
'text' => '',
     
'make_link' => 0,
     
'path' => '',
     
'link_class' => '',
     
'alt' => '',
     
'prefix' => '',
     
'suffix' => '',
     
'target' => '',
     
'help' => '',
     
'trim' => 0,
     
'max_length' => '',
     
'word_boundary' => 1,
     
'ellipsis' => 1,
     
'strip_tags' => 0,
     
'html' => 0,
    ),
   
'empty' => '',
   
'hide_empty' => 0,
   
'empty_zero' => 0,
   
'link_to_node' => 1,
   
'exclude' => 0,
   
'id' => 'title_1',
   
'table' => 'node',
   
'field' => 'title',
   
'relationship' => 'field_lieu_nid',
  ),
 
'title_2' => array(
   
'label' => 'Spectacle',
   
'alter' => array(
     
'alter_text' => 0,
     
'text' => '',
     
'make_link' => 0,
     
'path' => '',
     
'link_class' => '',
     
'alt' => '',
     
'prefix' => '',
     
'suffix' => '',
     
'target' => '',
     
'help' => '',
     
'trim' => 0,
     
'max_length' => '',
     
'word_boundary' => 1,
     
'ellipsis' => 1,
     
'strip_tags' => 0,
     
'html' => 0,
    ),
   
'empty' => '',
   
'hide_empty' => 0,
   
'empty_zero' => 0,
   
'link_to_node' => 1,
   
'exclude' => 0,
   
'id' => 'title_2',
   
'table' => 'node',
   
'field' => 'title',
   
'relationship' => 'field_spectacle_nid',
  ),
 
'field_date_value' => array(
   
'label' => '',
   
'alter' => array(
     
'alter_text' => 0,
     
'text' => '',
     
'make_link' => 0,
     
'path' => '',
     
'link_class' => '',
     
'alt' => '',
     
'prefix' => '',
     
'suffix' => '',
     
'target' => '',
     
'help' => '',
     
'trim' => 0,
     
'max_length' => '',
     
'word_boundary' => 1,
     
'ellipsis' => 1,
     
'strip_tags' => 0,
     
'html' => 0,
    ),
   
'empty' => '',
   
'hide_empty' => 0,
   
'empty_zero' => 0,
   
'link_to_node' => 0,
   
'label_type' => 'none',
   
'format' => 'date_seulement',
   
'multiple' => array(
     
'multiple_number' => '',
     
'multiple_from' => '',
     
'multiple_to' => '',
     
'group' => TRUE,
    ),
   
'repeat' => array(
     
'show_repeat_rule' => '',
    ),
   
'fromto' => array(
     
'fromto' => 'both',
    ),
   
'exclude' => 1,
   
'id' => 'field_date_value',
   
'table' => 'node_data_field_date',
   
'field' => 'field_date_value',
   
'relationship' => 'none',
  ),
 
'field_date_value_1' => array(
   
'label' => 'Date',
   
'alter' => array(
     
'alter_text' => 0,
     
'text' => '',
     
'make_link' => 0,
     
'path' => '',
     
'link_class' => '',
     
'alt' => '',
     
'prefix' => '',
     
'suffix' => '',
     
'target' => '',
     
'help' => '',
     
'trim' => 0,
     
'max_length' => '',
     
'word_boundary' => 1,
     
'ellipsis' => 1,
     
'strip_tags' => 0,
     
'html' => 0,
    ),
   
'empty' => '',
   
'hide_empty' => 0,
   
'empty_zero' => 0,
   
'link_to_node' => 0,
   
'label_type' => 'widget',
   
'format' => 'heure_seulement',
   
'multiple' => array(
     
'multiple_number' => '',
     
'multiple_from' => '',
     
'multiple_to' => '',
     
'group' => TRUE,
    ),
   
'repeat' => array(
     
'show_repeat_rule' => '',
    ),
   
'fromto' => array(
     
'fromto' => 'both',
    ),
   
'exclude' => 0,
   
'id' => 'field_date_value_1',
   
'table' => 'node_data_field_date',
   
'field' => 'field_date_value',
   
'relationship' => 'none',
  ),
));
$handler->override_option('sorts', array(
 
'field_date_value' => array(
   
'order' => 'ASC',
   
'delta' => -1,
   
'id' => 'field_date_value',
   
'table' => 'node_data_field_date',
   
'field' => 'field_date_value',
   
'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
 
'field_compagnie_nid' => array(
   
'default_action' => 'ignore',
   
'style_plugin' => 'default_summary',
   
'style_options' => array(),
   
'wildcard' => 'all',
   
'wildcard_substitution' => 'Tous / Toutes',
   
'title' => '%1',
   
'breadcrumb' => '',
   
'default_argument_type' => 'fixed',
   
'default_argument' => '',
   
'validate_type' => 'none',
   
'validate_fail' => 'not found',
   
'break_phrase' => 0,
   
'not' => 0,
   
'id' => 'field_compagnie_nid',
   
'table' => 'node_data_field_compagnie',
   
'field' => 'field_compagnie_nid',
   
'validate_user_argument_type' => 'uid',
   
'validate_user_roles' => array(
     
'2' => 0,
     
'5' => 0,
     
'3' => 0,
     
'6' => 0,
     
'4' => 0,
    ),
   
'relationship' => 'field_compagnie_nid',
   
'default_options_div_prefix' => '',
   
'default_argument_user' => 0,
   
'default_argument_fixed' => '',
   
'default_argument_php' => '',
   
'validate_argument_node_type' => array(
     
'compagnie' => 'compagnie',
     
'book' => 0,
     
'lieu' => 0,
     
'page' => 0,
     
'representation' => 0,
     
'simplenews' => 0,
     
'spectacle' => 0,
     
'story' => 0,
    ),
   
'validate_argument_node_access' => 0,
   
'validate_argument_nid_type' => 'nid',
   
'validate_argument_vocabulary' => array(
     
'15' => 0,
     
'18' => 0,
     
'1' => 0,
     
'2' => 0,
     
'16' => 0,
     
'14' => 0,
     
'17' => 0,
    ),
   
'validate_argument_type' => 'tid',
   
'validate_argument_transform' => 0,
   
'validate_user_restrict_roles' => 0,
   
'validate_argument_php' => '',
  ),
));
$handler->override_option('filters', array(
 
'type' => array(
   
'operator' => 'in',
   
'value' => array(
     
'representation' => 'representation',
    ),
   
'group' => '0',
   
'exposed' => FALSE,
   
'expose' => array(
     
'operator' => FALSE,
     
'label' => '',
    ),
   
'id' => 'type',
   
'table' => 'node',
   
'field' => 'type',
   
'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
 
'type' => 'none',
));
$handler->override_option('cache', array(
 
'type' => 'none',
));
$handler->override_option('empty', 'Aucune representation pour cette compagnie.');
$handler->override_option('empty_format', '1');
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
 
'grouping' => 'field_date_value',
 
'override' => 1,
 
'sticky' => 0,
 
'order' => 'asc',
 
'columns' => array(
   
'title' => 'title',
   
'type' => 'type',
   
'title_1' => 'title_1',
   
'title_2' => 'title_2',
   
'field_date_value' => 'field_date_value',
  ),
 
'info' => array(
   
'title' => array(
     
'sortable' => 0,
     
'separator' => '',
    ),
   
'type' => array(
     
'sortable' => 0,
     
'separator' => '',
    ),
   
'title_1' => array(
     
'sortable' => 0,
     
'separator' => '',
    ),
   
'title_2' => array(
     
'sortable' => 0,
     
'separator' => '',
    ),
   
'field_date_value' => array(
     
'sortable' => 0,
     
'separator' => '',
    ),
  ),
 
'default' => '-1',
));
$handler = $view->new_display('block', 'Bloc', 'block_1');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
?>
Fichier attachéTaille
Icône image spectacle_par_compagnie.png78.59 Ko

merci pour l'attention, je ne croyais pas qu'une personne allait regarder.
cette vue utilise les relations et mon probleme etait de pouvoir recuperer le nid du node affiché
et ma reponse vint en irc avec :

<Bes`> ok je viens de tester ce que je pensais ça à l'air de marcher
en mettant Action to take if argument is not present:
à Provide default argument
on a normalement meme pas besoin de faire de code pour récup l'id