From b73c0da389912458bda16a09c27b688d2833aaad Mon Sep 17 00:00:00 2001
From: Tim Steiner <tsteiner2@unl.edu>
Date: Thu, 14 Oct 2010 20:14:23 +0000
Subject: [PATCH] When creating blocks for Related Links, Footer, etc, remove
 the hard coded filter_format ids.

git-svn-id: file:///tmp/wdn_thm_drupal/trunk@242 20a16fea-79d4-4915-8869-1ea9d5ebf173
---
 profiles/unl_profile/unl_profile.install | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/profiles/unl_profile/unl_profile.install b/profiles/unl_profile/unl_profile.install
index 97828b7a..372523ea 100644
--- a/profiles/unl_profile/unl_profile.install
+++ b/profiles/unl_profile/unl_profile.install
@@ -124,7 +124,9 @@ EOF;
 UNL is an equal opportunity employer with a comprehensive plan for diversity. Find out more: <a href="https://employment.unl.edu/" target="_blank" title="Employment at UNL">employment.unl.edu</a><br />
 EOF;
     
+
     // Enable some standard blocks.
+    
     db_insert('block')
         ->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache'))
         ->values(array(
@@ -169,31 +171,40 @@ EOF;
         ))
         ->execute();
     
+    
+    // Get the default filter_format from the parent database.
+    $parent_site_database_settings = unl_profile_get_default_site_db_settings();
+    $parent_site_prefix = $parent_site_database_settings['default']['default']['prefix'];
+    $results = db_query("SELECT * FROM {$parent_site_prefix}filter_format WHERE status=1 ORDER BY weight LIMIT 1");
+    foreach ($results as $result) {
+      $format = $result->format;
+    }
+    
     db_insert('block_custom')
         ->fields(array('bid', 'body', 'info', 'format'))
         ->values(array(
             'bid'    => 101,
             'body'   => $block_contents['contactinfo'],
             'info'   => 'Contact Info',
-            'format' => 3
+            'format' => $format,
         ))
         ->values(array(
             'bid'    => 102,
             'body'   => $block_contents['leftcollinks'],
             'info'   => 'Related Links',
-            'format' => 3
+            'format' => $format,
         ))
         ->values(array(
             'bid'    => 103,
             'body'   => $block_contents['optionalfooter'],
             'info'   => 'Optional Footer',
-            'format' => 3
+            'format' => $format,
         ))
         ->values(array(
             'bid'    => 104,
             'body'   => $block_contents['footercontent'],
             'info'   => 'Footer Content',
-            'format' => 3
+            'format' => $format,
         ))
         ->execute();
     
-- 
GitLab