Projet

Général

Profil

Paste
Télécharger (1,22 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ctools / plugins / content_types / node_context / node_attachments.inc @ 136a805a

1
<?php
2

    
3
/**
4
 * Plugins are described by creating a $plugin array which will be used
5
 * by the system that includes this file.
6
 */
7
$plugin = array(
8
  'single' => TRUE,
9
  'title' => t('Attached files'),
10
  'icon' => 'icon_node.png',
11
  'description' => t('A list of files attached to the node.'),
12
  'required context' => new ctools_context_required(t('Node'), 'node'),
13
  'category' => t('Node'),
14
);
15

    
16
function ctools_node_attachments_content_type_render($subtype, $conf, $panel_args, $context) {
17
  $node = isset($context->data) ? clone $context->data : NULL;
18
  $block = new stdClass();
19
  $block->module = 'attachments';
20

    
21
  $block->title = t('Attached files');
22
  if ($node) {
23
    if (!empty($node->files)) {
24
      $block->content = theme('upload_attachments', $node->files);
25
    }
26
    $block->delta = $node->nid;
27
  }
28
  else {
29
    $block->content = t('Attached files go here.');
30
    $block->delta = 'unknown';
31
  }
32

    
33
  return $block;
34
}
35

    
36
function ctools_node_attachments_content_type_admin_title($subtype, $conf, $context) {
37
  return t('"@s" attachments', array('@s' => $context->identifier));
38
}
39

    
40
function ctools_node_attachments_content_type_edit_form($form, &$form_state) {
41
  // provide a blank form so we have a place to have context setting.
42
  return $form;
43
}
44