diff --git a/includes/project_issue_node_type.inc b/includes/project_issue_node_type.inc index 2cc7674..bc4d65c 100644 --- a/includes/project_issue_node_type.inc +++ b/includes/project_issue_node_type.inc @@ -575,10 +575,16 @@ function _project_issue_create_issue_node_type() { 'display' => array( 'default' => array( 'label' => 'above', - 'type' => 'file_default', + 'type' => 'file_metadata_table', 'settings' => array( + 'filetypes' => 'all', + 'extensions' => 'patch,diff', + 'columns' => array('cid', 'filename', 'filesize', 'uid'), + 'showhidden' => 'fieldset', + 'sortby' => 'cid', + 'sortorder' => 'desc', ), - 'module' => 'file', + 'module' => 'file_metadata_table', 'weight' => 4, ), 'teaser' => array( diff --git a/project_issue.info b/project_issue.info index c99d6f0..1e59cd1 100644 --- a/project_issue.info +++ b/project_issue.info @@ -10,6 +10,7 @@ dependencies[] = conflict dependencies[] = entityreference dependencies[] = dereference_list dependencies[] = nodechanges +dependencies[] = file_metadata_table ; @see http://drupal.org/project/module_supports recommends[] = flag_tracker diff --git a/project_issue.install b/project_issue.install index 2238eaa..447734d 100644 --- a/project_issue.install +++ b/project_issue.install @@ -790,4 +790,53 @@ function project_issue_update_7007() { // If the user has already updated things by hand, we can just skip // the update anyway, so we don't need to do anything.... } -} \ No newline at end of file +} + +/** + * Enable and begin using the 'File Metadata Table' field formatter + */ +function project_issue_update_7008() { + $t = get_t(); + + // Enable new dependency. + module_enable(array('file_metadata_table')); + + // Enable the field formatter on project_issue nodes + // The code below should worr for updating + $bundles = project_issue_issue_node_types(); + // Set up formatter settings + $display = array( + 'label' => 'above', + 'type' => 'file_metadata_table', + 'settings' => array( + 'filetypes' => 'all', + 'extensions' => 'patch,diff', + 'columns' => array('cid', 'filename', 'filesize', 'uid'), + 'showhidden' => 'fieldset', + 'sortby' => 'cid', + 'sortorder' => 'desc', + ), + 'module' => 'file_metadata_table', + 'weight' => 4, + ); + + // Cycle through each project_issue node type, and set the field_issue_files + // field to use the file metadata table field formatter. + foreach ($bundles as $bundle) { + // Update the display formatter for each bundle + if (field_info_instance('node', 'field_issue_files', $bundle)) { + $instance = array( + 'entity_type' => 'node', + 'bundle' => $bundle, + 'field_name' => 'field_issue_files', + 'display' => array( + 'default' => $display, + ), + ); + field_update_instance($instance); + } + } + + // Clear caches + drupal_flush_all_caches(); +}