getChunk removes @CODE section of snippet call

Hi, im manually procesing some elements, and I have the piece of code inside a chunk


[[+normalMenuTitle:strlen:isgreaterthan=`0`:then=`
                <base-dropdown tag="li" class="nav-item">
                    <a slot="title" href="#" class="nav-link" data-toggle="dropdown" role="button">
                        <i class="ni ni-collection d-lg-none"></i>
                        <span class="nav-link-inner--text">[[+normalMenuTitle]]</span>
                    </a>
                    [[!getImageList?
                      &tvname=`menuBigItems`
                      &tpl=`@CODE:<a to="/landing" class="dropdown-item">Landing</a>`]]
                  </base-dropdown>
                `]]
            </ul>

But after processing I’m getting

                <base-dropdown tag="li" class="nav-item">
                    <a slot="title" href="#" class="nav-link" data-toggle="dropdown" role="button">
                        <i class="ni ni-collection d-lg-none"></i>
                        <span class="nav-link-inner--text">Por aca</span>
                    </a>
                    [[!getImageList?
                      &tvname=`menuBigItems`
                      &tpl=
            </ul>
            <ul class="navbar-nav align-items-lg-center ml-lg-auto">

Where it correctly process the first part of the logic, but removes the CODE part and brokes the html.

If I put a chunk on the tpl field, it works as expected.

I’m still on a old version (2.8.1) will update and see if the problem persist on latest 2x

The issue only happens when the CODE was inside a preprocesor, when it’s not nested, it works as expected

[[!getImageList?
    &tvname=`socialMediaList`
    &tpl=`@CODE:
    <li class="nav-item">
      <a class="nav-link nav-link-icon" href="https://www.facebook.com/creativetim" target="_blank" rel="noopener"
         data-toggle="tooltip" title="Like us on Facebook">
          <i class="fa fa-facebook-square"></i>
          <span class="nav-link-inner--text d-lg-none">Facebook</span>
      </a>
  </li>
  `]]

I suspect the @-symbol confuses the MODX parser (probably because this character is also used to define the Property Set).

In my experience an uncached MODX tag nested inside a cached MODX tag quite often trips up the parser.

Maybe just call the getImageList snippet cached instead. Is there a reason why it is uncached?

You might just use a snippet, that may take the parsing error out of the picture, since the @ sign won’t be part of the page, and it will be much faster.

Something like this (untested):

<?php
if (!empty($modx->resource->getTVValue('normalMenuTitle'))) {

return '
<base-dropdown tag="li" class="nav-item">
    <a slot="title" href="#" class="nav-link" data-toggle="dropdown"
           role="button">
        <i class="ni ni-collection d-lg-none"></i>
        <span class="nav-link-inner--text">[[+normalMenuTitle]]</span>
    </a>
    [[!getImageList?
        &tvname=`menuBigItems`
        &tpl=`@CODE:<a to="/landing" class="dropdown-item">Landing</a>`]]
</base-dropdown>'; 

} else {
    return "";
}

The parsing error would be gone for sure (and it would be even faster yet) if you replaced the getImageIist tag in the code above with a call to $modx->runSnippet('getImageList');