Projet

Général

Profil

Révision 5d12d676

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/views/modules/node.views.inc
12 12
 */
13 13
function node_views_data() {
14 14
  // ----------------------------------------------------------------
15
  // node table -- basic table information.
16

  
17
  // Define the base group of this table. Fields that don't
18
  // have a group defined will go into this field by default.
15
  // 'node' table -- basic table information.
16
  // Define the base group of this table. Fields that don't have a group
17
  // defined will go into this field by default.
19 18
  $data['node']['table']['group'] = t('Content');
20 19

  
21
  // Advertise this table as a possible base table
20
  // Advertise this table as a possible base table.
22 21
  $data['node']['table']['base'] = array(
23 22
    'field' => 'nid',
24 23
    'title' => t('Content'),
......
38 37
  );
39 38

  
40 39
  // ----------------------------------------------------------------
41
  // node table -- fields
42

  
43
  // nid
40
  // 'node' table -- fields.
41
  // Node ID / 'nid'.
44 42
  $data['node']['nid'] = array(
43
    // The item it appears as on the UI,
45 44
    'title' => t('Nid'),
46
    'help' => t('The node ID.'), // The help that appears on the UI,
47
    // Information for displaying the nid
45
    // The help that appears on the UI,
46
    'help' => t('The node ID.'),
47
    // Information for displaying the nid.
48 48
    'field' => array(
49 49
      'handler' => 'views_handler_field_node',
50 50
      'click sortable' => TRUE,
51 51
    ),
52
    // Information for accepting a nid as an argument
52
    // Information for accepting a nid as an argument.
53 53
    'argument' => array(
54 54
      'handler' => 'views_handler_argument_node_nid',
55
      'name field' => 'title', // the field to display in the summary.
55
      'name field' => 'title',
56
      // The field to display in the summary.
56 57
      'numeric' => TRUE,
57 58
      'validate type' => 'nid',
58 59
    ),
59
    // Information for accepting a nid as a filter
60
    // Information for accepting a nid as a filter.
60 61
    'filter' => array(
61 62
      'handler' => 'views_handler_filter_numeric',
62 63
    ),
......
66 67
    ),
67 68
  );
68 69

  
69
  // title
70
  // Title.
70 71
  // This definition has more items in it than it needs to as an example.
71 72
  $data['node']['title'] = array(
72
    'title' => t('Title'), // The item it appears as on the UI,
73
    'help' => t('The content title.'), // The help that appears on the UI,
74
     // Information for displaying a title as a field
73
    // The item it appears as on the UI,
74
    'title' => t('Title'),
75
    // The help that appears on the UI,
76
    'help' => t('The content title.'),
77
    // Information for displaying a title as a field.
75 78
    'field' => array(
76
      'field' => 'title', // the real field. This could be left out since it is the same.
77
      'group' => t('Content'), // The group it appears in on the UI. Could be left out.
79
      'field' => 'title',
80
      // The real field. This could be left out since it is the same.
81
      'group' => t('Content'),
82
      // The group it appears in on the UI. Could be left out.
78 83
      'handler' => 'views_handler_field_node',
79 84
      'click sortable' => TRUE,
80 85
      'link_to_node default' => TRUE,
81
     ),
86
    ),
82 87
    'sort' => array(
83 88
      'handler' => 'views_handler_sort',
84 89
    ),
85
    // Information for accepting a title as a filter
90
    // Information for accepting a title as a filter.
86 91
    'filter' => array(
87 92
      'handler' => 'views_handler_filter_string',
88 93
    ),
......
91 96
    ),
92 97
  );
93 98

  
94
  // created field
99
  // Created field.
95 100
  $data['node']['created'] = array(
96
    'title' => t('Post date'), // The item it appears as on the UI,
97
    'help' => t('The date the content was posted.'), // The help that appears on the UI,
101
    // The item it appears as on the UI,
102
    'title' => t('Post date'),
103
    // The help that appears on the UI,
104
    'help' => t('The date the content was posted.'),
98 105
    'field' => array(
99 106
      'handler' => 'views_handler_field_date',
100 107
      'click sortable' => TRUE,
......
107 114
    ),
108 115
  );
109 116

  
110
  // changed field
117
  // Changed field.
111 118
  $data['node']['changed'] = array(
112
    'title' => t('Updated date'), // The item it appears as on the UI,
113
    'help' => t('The date the content was last updated.'), // The help that appears on the UI,
119
    // The item it appears as on the UI,
120
    'title' => t('Updated date'),
121
    // The help that appears on the UI,
122
    'help' => t('The date the content was last updated.'),
114 123
    'field' => array(
115 124
      'handler' => 'views_handler_field_date',
116 125
      'click sortable' => TRUE,
......
123 132
    ),
124 133
  );
125 134

  
126
  // Content type
135
  // Content type.
127 136
  $data['node']['type'] = array(
128
    'title' => t('Type'), // The item it appears as on the UI,
129
    'help' => t('The content type (for example, "blog entry", "forum post", "story", etc).'), // The help that appears on the UI,
137
    // The item it appears as on the UI,
138
    'title' => t('Type'),
139
    // The help that appears on the UI,
140
    'help' => t('The content type (for example, "blog entry", "forum post", "story", etc).'),
130 141
    'field' => array(
131 142
      'handler' => 'views_handler_field_node_type',
132 143
      'click sortable' => TRUE,
......
142 153
    ),
143 154
  );
144 155

  
145
  // published status
156
  // Published status.
146 157
  $data['node']['status'] = array(
147 158
    'title' => t('Published'),
148 159
    'help' => t('Whether or not the content is published.'),
......
157 168
      'handler' => 'views_handler_filter_boolean_operator',
158 169
      'label' => t('Published'),
159 170
      'type' => 'yes-no',
160
      'use equal' => TRUE, // Use status = 1 instead of status <> 0 in WHERE statment
171
      'use equal' => TRUE,
172
      // Use status = 1 instead of status <> 0 in WHERE statment.
161 173
    ),
162 174
    'sort' => array(
163 175
      'handler' => 'views_handler_sort',
164 176
    ),
165 177
  );
166 178

  
167
  // published status + extra
179
  // Published status + extra.
168 180
  $data['node']['status_extra'] = array(
169 181
    'title' => t('Published or admin'),
170 182
    'help' => t('Filters out unpublished content if the current user cannot view it.'),
......
175 187
    ),
176 188
  );
177 189

  
178
  // promote status
190
  // Promote status.
179 191
  $data['node']['promote'] = array(
180 192
    'title' => t('Promoted to front page'),
181 193
    'help' => t('Whether or not the content is promoted to the front page.'),
......
196 208
    ),
197 209
  );
198 210

  
199
  // sticky
211
  // Sticky.
200 212
  $data['node']['sticky'] = array(
201
    'title' => t('Sticky'), // The item it appears as on the UI,
202
    'help' => t('Whether or not the content is sticky.'), // The help that appears on the UI,
203
     // Information for displaying a title as a field
213
    // The item it appears as on the UI,
214
    'title' => t('Sticky'),
215
    // The help that appears on the UI,
216
    'help' => t('Whether or not the content is sticky.'),
217
    // Information for displaying a title as a field.
204 218
    'field' => array(
205 219
      'handler' => 'views_handler_field_boolean',
206 220
      'click sortable' => TRUE,
......
221 235

  
222 236
  // Define some fields based upon views_handler_field_entity in the entity
223 237
  // table so they can be re-used with other query backends.
224
  // @see views_handler_field_entity
225

  
238
  // @see views_handler_field_entity()
226 239
  $data['views_entity_node']['table']['group'] = t('Content');
227 240

  
228 241
  $data['node']['view_node']['moved to'] = array('views_entity_node', 'view_node');
......
260 273
    ),
261 274
  );
262 275

  
263

  
264 276
  // Bogus fields for aliasing purposes.
265

  
266 277
  $data['node']['created_fulldate'] = array(
267 278
    'title' => t('Created date'),
268 279
    'help' => t('Date in the form of CCYYMMDD.'),
......
371 382
    ),
372 383
  );
373 384

  
374
  // uid field
385
  // User ID / 'uid' field.
375 386
  $data['node']['uid'] = array(
376 387
    'title' => t('Author uid'),
377 388
    'help' => t('The user authoring the content. If you need more fields than the uid add the content: author relationship'),
......
424 435
  );
425 436

  
426 437
  // ----------------------------------------------------------------------
427
  // Content revision table
428

  
429
  // Define the base group of this table. Fields that don't
430
  // have a group defined will go into this field by default.
438
  // Content revision table.
439
  // Define the base group of this table. Fields that don't have a group
440
  // defined will go into this field by default.
431 441
  $data['node_revisions']['moved to'] = 'node_revision';
432 442
  $data['node_revision']['table']['entity type'] = 'node';
433 443
  $data['node_revision']['table']['revision'] = TRUE;
434 444
  $data['node_revision']['table']['group']  = t('Content revision');
435
  // Support the conversion of the field body
445
  // Support the conversion of the field body.
436 446
  $data['node_revisions']['body']['moved to'] = array('field_revision_data', 'body-revision_id');
437 447

  
438
  // Advertise this table as a possible base table
448
  // Advertise this table as a possible base table.
439 449
  $data['node_revision']['table']['base'] = array(
440 450
    'field' => 'vid',
441 451
    'title' => t('Content revision'),
......
445 455
    ),
446 456
  );
447 457

  
448
  // For other base tables, explain how we join
458
  // For other base tables, explain how we join.
449 459
  $data['node_revision']['table']['join'] = array(
450 460
    // Directly links to node table.
451 461
    'node' => array(
......
461 471
    ),
462 472
  );
463 473

  
464
  // uid field for node revision
474
  // User ID / 'uid' field for node revision.
465 475
  $data['node_revision']['uid'] = array(
466 476
    'title' => t('User'),
467 477
    'help' => t('Relate a content revision to the user who created the revision.'),
......
473 483
    ),
474 484
  );
475 485

  
476
  // nid
486
  // Node ID / 'nid'.
477 487
  $data['node_revision']['nid'] = array(
478 488
    'title' => t('Nid'),
479 489
    // The help that appears on the UI.
......
505 515
    ),
506 516
  );
507 517

  
508
  // vid
518
  // Revision ID / 'vid'.
509 519
  $data['node_revision']['vid'] = array(
510 520
    'title' => t('Vid'),
511 521
    // The help that appears on the UI.
......
537 547
    ),
538 548
  );
539 549

  
540
  // title
550
  // Title.
541 551
  $data['node_revision']['title'] = array(
542
    'title' => t('Title'), // The item it appears as on the UI,
543
    'help' => t('The content title.'), // The help that appears on the UI,
544
     // Information for displaying a title as a field
552
    // The item it appears as on the UI,
553
    'title' => t('Title'),
554
    // The help that appears on the UI,
555
    'help' => t('The content title.'),
556
    // Information for displaying a title as a field.
545 557
    'field' => array(
546
      'field' => 'title', // the real field
558
      'field' => 'title',
559
      // The real field.
547 560
      'handler' => 'views_handler_field_node_revision',
548 561
      'click sortable' => TRUE,
549
     ),
562
    ),
550 563
    'sort' => array(
551 564
      'handler' => 'views_handler_sort',
552 565
    ),
......
558 571
    ),
559 572
  );
560 573

  
561
  // log field
574
  // Log field.
562 575
  $data['node_revision']['log'] = array(
563
    'title' => t('Log message'), // The item it appears as on the UI,
564
    'help' => t('The log message entered when the revision was created.'), // The help that appears on the UI,
565
     // Information for displaying a title as a field
576
    // The item it appears as on the UI,
577
    'title' => t('Log message'),
578
    // The help that appears on the UI,
579
    'help' => t('The log message entered when the revision was created.'),
580
    // Information for displaying a title as a field.
566 581
    'field' => array(
567 582
      'handler' => 'views_handler_field_xss',
568
     ),
583
    ),
569 584
    'filter' => array(
570 585
      'handler' => 'views_handler_filter_string',
571 586
    ),
572 587
  );
573 588

  
574
  // revision timestamp
575
  // changed field
589
  // Revision timestamp / 'changed' field.
576 590
  $data['node_revision']['timestamp'] = array(
577
    'title' => t('Updated date'), // The item it appears as on the UI,
578
    'help' => t('The date the node was last updated.'), // The help that appears on the UI,
591
    // The item it appears as on the UI,
592
    'title' => t('Updated date'),
593
    // The help that appears on the UI,
594
    'help' => t('The date the node was last updated.'),
579 595
    'field' => array(
580 596
      'handler' => 'views_handler_field_date',
581 597
      'click sortable' => TRUE,
......
613 629
  );
614 630

  
615 631
  // ----------------------------------------------------------------------
616
  // Node access table
617

  
618
  // Define the base group of this table. Fields that don't
619
  // have a group defined will go into this field by default.
632
  // Node access table.
633
  // Define the base group of this table. Fields that don't have a group
634
  // defined will go into this field by default.
620 635
  $data['node_access']['table']['group']  = t('Content access');
621 636

  
622
  // For other base tables, explain how we join
637
  // For other base tables, explain how we join.
623 638
  $data['node_access']['table']['join'] = array(
624 639
    // Directly links to node table.
625 640
    'node' => array(
......
627 642
      'field' => 'nid',
628 643
    ),
629 644
  );
630
  // nid field
645
  // Node ID / 'nid' field.
631 646
  $data['node_access']['nid'] = array(
632 647
    'title' => t('Access'),
633 648
    'help' => t('Filter by access.'),
......
638 653
  );
639 654

  
640 655
  // ----------------------------------------------------------------------
641
  // History table
642

  
643
  // We're actually defining a specific instance of the table, so let's
644
  // alias it so that we can later add the real table for other purposes if we
645
  // need it.
656
  // History table.
657
  // We're actually defining a specific instance of the table, so let's alias
658
  // it so that we can later add the real table for other purposes if we need
659
  // it.
646 660
  $data['history_user']['moved to'] = 'history';
647 661
  $data['history']['table']['group']  = t('Content');
648 662

  
......
678 692
 */
679 693
function node_views_plugins() {
680 694
  return array(
681
    'module' => 'views', // This just tells our themes are elsewhere.
695
    'module' => 'views',
696
    // This just tells our themes are elsewhere.
682 697
    'row' => array(
683 698
      'node' => array(
684 699
        'title' => t('Content'),
685 700
        'help' => t('Display the content with standard node view.'),
686 701
        'handler' => 'views_plugin_row_node_view',
687
        'path' => drupal_get_path('module', 'views') . '/modules/node', // not necessary for most modules
688
        'base' => array('node'), // only works with 'node' as base.
702
        'path' => drupal_get_path('module', 'views') . '/modules/node',
703
        // Not necessary for most modules.
704
        'base' => array('node'),
705
        // Only works with 'node' as base.
689 706
        'uses options' => TRUE,
690 707
        'type' => 'normal',
691 708
        'help topic' => 'style-node',
......
694 711
        'title' => t('Content'),
695 712
        'help' => t('Display the content with standard node view.'),
696 713
        'handler' => 'views_plugin_row_node_rss',
697
        'path' => drupal_get_path('module', 'views') . '/modules/node', // not necessary for most modules
714
        'path' => drupal_get_path('module', 'views') . '/modules/node',
715
        // Not necessary for most modules.
698 716
        'theme' => 'views_view_row_rss',
699
        'base' => array('node'), // only works with 'node' as base.
717
        'base' => array('node'),
718
        // Only works with 'node' as base.
700 719
        'uses options' => TRUE,
701 720
        'type' => 'feed',
702 721
        'help topic' => 'style-node-rss',
......
711 730
    'argument default' => array(
712 731
      'node' => array(
713 732
        'title' => t('Content ID from URL'),
714
        'handler' => 'views_plugin_argument_default_node'
733
        'handler' => 'views_plugin_argument_default_node',
715 734
      ),
716 735
    ),
717 736
  );
......
745 764
  return array(
746 765
    '***ADMINISTER_NODES***' => intval(user_access('administer nodes')),
747 766
    '***VIEW_OWN_UNPUBLISHED_NODES***' => intval(user_access('view own unpublished content')),
748
    '***BYPASS_NODE_ACCESS***' =>  intval(user_access('bypass node access')),
767
    '***BYPASS_NODE_ACCESS***' => intval(user_access('bypass node access')),
749 768
  );
750 769
}
751 770

  
......
754 773
 */
755 774
function node_views_analyze($view) {
756 775
  $ret = array();
757
  // Check for something other than the default display:
776
  // Check for something other than the default display.
758 777
  if ($view->base_table == 'node') {
759 778
    foreach ($view->display as $id => $display) {
760 779
      if (empty($display->handler)) {
761 780
        continue;
762 781
      }
763 782
      if (!$display->handler->is_defaulted('access') || !$display->handler->is_defaulted('filters')) {
764
        // check for no access control
783
        // Check for no access control.
765 784
        $access = $display->handler->get_option('access');
766 785
        if (empty($access['type']) || $access['type'] == 'none') {
767 786
          $select = db_select('role', 'r');

Formats disponibles : Unified diff