Projet

Général

Profil

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

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

1
<?php
2

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

    
9
$plugin = array(
10
  'single' => TRUE,
11
  'title' => t('Attached files'),
12
  'icon' => 'icon_node.png',
13
  'description' => t('A list of files attached to the node.'),
14
  'required context' => new ctools_context_required(t('Node'), 'node'),
15
  'category' => t('Node'),
16
);
17

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

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

    
35
  return $block;
36
}
37

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

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