I have a custom pattern containing a block specification as follows:

    <block id="user-3">
      <status>1</status>      
      <weight>-4</weight>
      <region>left</region>
      <visibility>1</visibility>
      <pages>
        <path>[front]</path>
        <path>test</path>
      </pages>
    </block>

The problem was the 'pages' element wasn't being loaded properly. Specifically, _patterns_rearrange_data() wasn't re-arranging it properly because the 'pages' tag only contained a nested element and no inner text.

The patch below fixes this and ensures that this element (and indeed all other such nested elements for other tags) get re-arranged, and thus loaded properly.


--- C:\Users\Ramesh\AppData\Local\Temp\patterns.module-revBASE.svn000.tmp.module	2010-07-05 13:38:23.000000000 +-0100
+++ Q:\nbc\kola_rnair\src\sites\all\modules\patterns\patterns.module	2010-07-05 13:38:14.000000000 +-0100
@@ -1975,13 +1975,14 @@
 function _patterns_rearrange_data($data, $parent = '') {
   $numeric = array();
   $count=0;
 
   foreach($data as $key => $value) {
   	
-  	if (!isset($value['value']))
+  	##! Patch to ensure we don't skips tags containing nested data
+  	if (!isset($value['value']) && !isset($value['tag']))
   	 continue;
   	
     if ($value['value'] == 'false') {
       $value['value'] = false;
     }
     else if ($value['value'] == 'true') {

Patch also attached.

CommentFileSizeAuthor
#1 patterns.module.patch1.21 KBhiddentao
patterns.module.patch704 byteshiddentao

Comments

hiddentao’s picture

StatusFileSize
new1.21 KB

Better patch attached. This prevents PHP Notice messages introduced with first version of the patch.