I am getting the following error when trying to add AdSense block (using the AdSense module) using the Add content feature for a region.

An error occurred while attempting to process /panels/ajax/add-pane-config/panel_context%3Anode_view%3Anode_view_panel_context_2/content/block/adsense_managed-0

Other blocks work just fine, but not this one. I have also tested the block in other places and it works as expected.

Comments

tsvenson’s picture

Using the Custom content pane and the PHP filter it is possible to get around this bug.

Simply paste in the relevant code from the AdSense module help instructions and it is working.

merlinofchaos’s picture

Does the adsense module use <script> tags in the block?

tsvenson’s picture

If your talking about the output, then yes since it is needed for the ads to work.

This is how the source code of the page looks when I place the block in a region outside panels control:

<div id="block-adsense_managed-0" class="block block-adsense_managed region-even even region-count-2 count-2"> 
 
 
  <div class="content"><div style='text-align:center'><div class='adsense adsense_managed'> 
<script type="text/javascript"><!--
google_ad_client = "pub-xxxxxxxxxxxxxxxxxx";
/* 468x60 */
google_ad_slot = "xxxxxxxxxxx";
google_ad_width = 468;
google_ad_height = 60;
google_adtest = 'on';
 
//-->
</script> 
<script type="text/javascript"

src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> 
</script> 
</div></div></div> 
  
</div>
merlinofchaos’s picture

It probably breaks when the block is rendered via AJAX in the admin UI. If you look at blocks (and only blocks) they are actually rendered beneath the collapsible arrow. That script tag probably confuses the client when it tries to render and causes a crash. So for now, your best workaround is to go ahead and use a custom pane which won't render that way.

tsvenson’s picture

Thanks for the explanation. Since I get the same result using the custom pane its not a big issue anymore.

Is this something that will happen with every block that uses the <script> tag? Just wondering since I plan to use a few modules that I believe will use it as well.

merlinofchaos’s picture

Priority: Critical » Minor

Likely yes. I need to fix that and defang the script tags.

merlinofchaos’s picture

Project: Panels » Chaos Tool Suite (ctools)
Version: 6.x-3.2 » 6.x-1.x-dev
Status: Active » Fixed

Committed a fix to CTools to prevent this.

tsvenson’s picture

Hi merlin,

I just updated to the ctools 1.3 & panels 3,3 you released today and I still get the same error trying to add the AdSense block.

tsvenson’s picture

Status: Fixed » Active

Forgot to change it back to active.

merlinofchaos’s picture

Hm. I don't see how this can be happening. I'm filtering the block output and that should remove all script and object tags.

merlinofchaos’s picture

Status: Active » Fixed

Try current -dev. It should work now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Mechanical Engineer’s picture

yeah thank you it's now fixed :)

a.ross’s picture

Status: Closed (fixed) » Active

Still not working in 1.8 nor latest -dev.

mropanen’s picture

Version: 6.x-1.x-dev » 7.x-1.0

Also not working in 7.x-1.0

  • merlinofchaos committed 48e377d on 8.x-2.x
    #693742: Sanitize block admin output (to Panels drag...

  • merlinofchaos committed 48e377d on 8.x-3.x
    #693742: Sanitize block admin output (to Panels drag...