Projet

Général

Profil

Révision c304a780

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ctools/plugins/content_types/node_context/node_terms.inc
1 1
<?php
2 2

  
3 3
/**
4
 * @file
4 5
 * Plugins are described by creating a $plugin array which will be used
5 6
 * by the system that includes this file.
6 7
 */
8

  
7 9
$plugin = array(
8 10
  'single' => TRUE,
9 11
  'title' => t('Node terms'),
......
30 32
  // Get a shortcut to the node.
31 33
  $node = $context->data;
32 34

  
33
  // Load all terms for this node from all vocabularies
35
  // Load all terms for this node from all vocabularies.
34 36
  $query = db_select('taxonomy_index', 't');
35 37
  $result = $query
36 38
    ->fields('t')
......
38 40
    ->execute();
39 41

  
40 42
  $tids = array();
41
  foreach ($result AS $term) {
43
  foreach ($result as $term) {
42 44
    $tids[] = $term->tid;
43 45
  }
44 46

  
45
  // Get the real term objects
47
  // Get the real term objects.
46 48
  $term_objects = taxonomy_term_load_multiple($tids);
47 49

  
48 50
  $terms = array();
49 51

  
50 52
  if (empty($conf['vid'])) {
51 53
    // All terms.
52
    foreach ($term_objects AS $term) {
54
    foreach ($term_objects as $term) {
53 55
      $terms['taxonomy_term_' . $term->tid] = array(
54 56
        'title' => check_plain($term->name),
55 57
        'href' => 'taxonomy/term/' . $term->tid,
56
        'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description))
58
        'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description)),
57 59
      );
58 60
    }
59 61
  }
......
106 108
  }
107 109

  
108 110
  // Build the content type block.
109
  $block = new stdClass();
111
  $block          = new stdClass();
110 112
  $block->module  = 'node_terms';
111 113
  $block->delta   = $node->nid;
112 114
  $block->title   = t('Terms');

Formats disponibles : Unified diff