node_attachments.inc 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * @file
  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. function ctools_node_attachments_content_type_render($subtype, $conf, $panel_args, $context) {
  16. $node = isset($context->data) ? clone $context->data : NULL;
  17. $block = new stdClass();
  18. $block->module = 'attachments';
  19. $block->title = t('Attached files');
  20. if ($node) {
  21. if (!empty($node->files)) {
  22. $block->content = theme('upload_attachments', $node->files);
  23. }
  24. $block->delta = $node->nid;
  25. }
  26. else {
  27. $block->content = t('Attached files go here.');
  28. $block->delta = 'unknown';
  29. }
  30. return $block;
  31. }
  32. function ctools_node_attachments_content_type_admin_title($subtype, $conf, $context) {
  33. return t('"@s" attachments', array('@s' => $context->identifier));
  34. }
  35. function ctools_node_attachments_content_type_edit_form($form, &$form_state) {
  36. // Provide a blank form so we have a place to have context setting.
  37. return $form;
  38. }