Panel Hook Question

I’m wondering if there are any issues caused by using multiple panel hooks. I had the following code working to create pdfs on the fly each time a product was updated.

I’ve then tried to add another bit of code to the same panel hook so if a certain field is updated it will then send an email to a specified email address. The page hangs now every time I try to update a product, even with that bit of code removed the page is still hanging on page creation and also update.

Any advice?

My code is as follows and is in the config file, Would it be better as a plugin as the PDF generation code is quite a large block.

    /* Hooks -  Reference Field
    ---------------------------------------------------------------------------- */
    kirby()->hook('panel.page.create', function($page) {
            
    // THIS IS CODE TO UPDATE A FIELD
    
    });

   /* Hooks -  PDF Creation
   ---------------------------------------------------------------------------- */
   kirby()->hook('panel.page.update', function($page) {

   if($page->hasTemplate('product')) {   
    
    // CODE HERE TO GENERATE PDF
    
   };

});

UPDATE:

I’m not so sure its related to the hooks issue. It seems even if a page is created elsewhere in the panel then the same issue applies. Each time a page is created or edited the panel wont load. Eventually if the loading is stopped it shows an error 500 message.

Any idea?

I’m getting the following messages in Inspect Element too.

The kirby installation is the latest release and no core changes.


Do you get the same error if you remove the hooks completely?

What have you changed in your installation? Did this only happen after the update to 2.3.0?

Hi texnixe,

Same issue even if I remove the Hooks. I’ve tried replacing the panel and kirby folders from a fresh download but still the same.

My config is pretty standard as can be seen:

 <?php

 /* Setup
 ---------------------------------------------------------------------------- */

 c::set('license', 'put your license key here');
 c::set('home','shop');

 /* User roles
 ---------------------------------------------------------------------------- */

c::set('roles', array(
array(
    'id'      => 'admin',
    'name'    => 'Admin',
    'default' => false,
    'panel'   => true
),
array(
    'id'      => 'manager',
    'name'    => 'Manager',
    'default' => false,
    'panel'   => false
),
array(
    'id'      => 'shop',
    'name'    => 'Shop',
    'default' => false,
    'panel'   => false
),
array(
    'id'      => 'dealer',
    'name'    => 'Dealer',
    'default' => false,
    'panel'   => false
)
));

I’ve also tried removing the plugin i created but still I have the same issue.

Also, The page save will work correctly if there is no changes to any of the fields. as soon as there is a change this is when it hangs up.

I’m pulling my hair out here, The error logs don’t show anything either.

Hope you’ve got enough hair, so you won’t miss it that badly :wink:

Anyway, you somehow missed to answer my question if you have made any changes to your setup and if this only happened after updating to 2.3.0.

Do you get the same issue on localhost?

I’ve found the Issue :slight_smile:

Sorry about missing your question, I thought I had answered it!

The issue was a missing colon from a blueprint strangely enough. All working fine now. Thanks for your help anyways!

Glad you sorted it out :slight_smile: