node_attachments.inc

Go to the documentation of this file.
00001 <?php
00002 // $Id: node_attachments.inc,v 1.1.2.8 2008/05/27 20:21:11 sdboyer Exp $
00003 
00004 
00005 /**
00006  * Callback function to supply a list of content types.
00007  */
00008 function panels_node_attachments_panels_content_types() {
00009   $items['node_attachments'] = array(
00010     'title' => t('Node type description'),
00011     // only provides a single content type
00012     'single' => TRUE,
00013     'content_types' => 'panels_admin_content_types_node_attachments',
00014     'render callback' => 'panels_content_node_attachments',
00015 //      'add callback' => 'panels_admin_edit_node_attachments',
00016 //      'edit callback' => 'panels_admin_edit_node_attachments',
00017     'title callback' => 'panels_admin_title_node_attachments',
00018   );
00019   return $items;
00020 }
00021 
00022 /**
00023  * Output function for the 'node' content type. Outputs a node
00024  * based on the module and delta supplied in the configuration.
00025  */
00026 function panels_content_node_attachments($conf, $panel_args, $context) {
00027   $node = isset($context->data) ? drupal_clone($context->data) : NULL;
00028   $block = new stdClass();
00029   $block->module = 'attachments';
00030 
00031   $block->subject = t('Attached files');
00032   if ($node) {
00033     $block->content = theme('upload_attachments', $node->files);
00034     $block->delta = $node->nid;
00035   }
00036   else {
00037     $block->content = t('Attached files go here.');
00038     $block->delta = 'unknown';
00039   }
00040 
00041   return $block;
00042 }
00043 
00044 /**
00045  * Return all content types available.
00046  */
00047 function panels_admin_content_types_node_attachments() {
00048   return array(
00049     'node_type' => array(
00050       'title' => t('Attached files'),
00051       'icon' => 'icon_node.png',
00052       'path' => panels_get_path('content_types/node'),
00053       'description' => t('A list of files attached to the node.'),
00054       'required context' => new panels_required_context(t('Node'), 'node'),
00055       'category' => array(t('Node context'), -9),
00056     ),
00057   );
00058 }
00059 
00060 function panels_admin_title_node_attachments($conf, $context) {
00061   return t('"@s" attachments', array('@s' => $context->identifier));
00062 }
00063 

Generated on Thu Jul 29 05:00:14 2010 for Panels 2 by  doxygen 1.5.6