Hey all,

Probably caused by new 1.2.1 slot callbacks, but here's an issue needing your advice. Shortly (in style of MetalSlotTest::testSimple()):

INPUT:
<div>
 <tal:block metal:define-macro="subpage">
   <tal:block metal:use-macro="page">
       <tal:block metal:fill-slot="valuebis">
           <div>Valuebis from subpage block</div>
       </tal:block>
   </tal:block>
 </tal:block>

 <tal:block metal:define-macro="page">
   page-a:<span metal:define-slot="value">a value should go here</span>
   page-b:<span metal:define-slot="valuebis">another here</span>
 </tal:block>

 <tal:block metal:use-macro="subpage">
<tal:block metal:fill-slot="valuebis">unused invalid valuebis</ tal:block>
   <tal:block metal:fill-slot="value">
       <div>Value from the first blocks</div>
   </tal:block>
 </tal:block>
</div>

EXPECTED OUTPUT (and as of 1.1.16 and 1.2.0):
<div>page-a:<div>Value from the first blocks</div>page-b:<div>Valuebis from subpage block</div></div>

REAL OUTPUT (1.2.1):
<div>page-a:<span>a value should go here</span>page-b:<div>Valuebis from subpage block</div></div>

PROBLEM:
Metal:fill-slot values are not carried over from within nested macro calls any more, unable to find another way to achieve the same result. Is this intentional behavior?

It does work with tal:define global / replace structure but it is not as elegant solution as slots. Any better ideas how work around it?

If it isn't on purpose, a simple patch fixes it back to 1.2.0 way (and then pls could above test be included in testsuite too?): diff -r PHPTAL-1.2.1/PHPTAL/Context.php /apache2/php/lib/php/PHPTAL/ Context.php
165a166,169
>         if ($this->_parentContext) {
> return $this->_parentContext->hasSlot($key); // setting slots in any context
>         }
>



Many thanks
Ekke


PS. Similar issue, same fix here but probably doesn't adhere to standard here (fill-slot="valuebis" straight inside 'subpage', outside of use-macro="page"):

<div>
 <tal:block metal:define-macro="subpage">
   <tal:block metal:fill-slot="valuebis">
       <div>Valuebis from subpage block</div>
   </tal:block>
   <tal:block metal:use-macro="page" />
 </tal:block>

 <tal:block metal:define-macro="page">
   page-b:<span metal:define-slot="valuebis">another here</span>
 </tal:block>

 <tal:block metal:use-macro="subpage" />
</div>

_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to