node_attachments.inc 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Plugins are described by creating a $plugin array which will be used
  4. * by the system that includes this file.
  5. */
  6. $plugin = array(
  7. 'single' => TRUE,
  8. 'title' => t('Attached files'),
  9. 'icon' => 'icon_node.png',
  10. 'description' => t('A list of files attached to the node.'),
  11. 'required context' => new ctools_context_required(t('Node'), 'node'),
  12. 'category' => t('Node'),
  13. );
  14. function ctools_node_attachments_content_type_render($subtype, $conf, $panel_args, $context) {
  15. $node = isset($context->data) ? clone $context->data : NULL;
  16. $block = new stdClass();
  17. $block->module = 'attachments';
  18. $block->title = t('Attached files');
  19. if ($node) {
  20. if (!empty($node->files)) {
  21. $block->content = theme('upload_attachments', $node->files);
  22. }
  23. $block->delta = $node->nid;
  24. }
  25. else {
  26. $block->content = t('Attached files go here.');
  27. $block->delta = 'unknown';
  28. }
  29. return $block;
  30. }
  31. function ctools_node_attachments_content_type_admin_title($subtype, $conf, $context) {
  32. return t('"@s" attachments', array('@s' => $context->identifier));
  33. }
  34. function ctools_node_attachments_content_type_edit_form($form, &$form_state) {
  35. // provide a blank form so we have a place to have context setting.
  36. return $form;
  37. }