Jump to content

Recommended Posts

Posted

Hi.

I have page tree like that:

Product Types ( name: catalog_filters )

  • disinfectants-and-hygiene
  • antibiotics-injectable
  • antibiotics-oral

Products ( name: products ) 

  • product1
  • product2

Also I have hook in my ready.php

function productCategoriesAndTypes(HookEvent $event){
    $page = $event->object; 
    if($page->template == 'product-category' || $page->template == 'product-type') $event->return = "/products/$page->name/";

}

$wire->addHookAfter("Page::path", "productCategoriesAndTypes");

It works as expeted and I get modified urls in PageTree, PagePreview and in ProcessPageEdit:

Screenshot_5.jpg

But after page save I get not hooked page url

Screenshot_6.jpg

It looks like ProcessPageEdit does not respect hook in ready.php.

Is it a bug or I'm missing some setting or it is not right place for hook or I have hook also some other method? 

As further investigation I have found that problem comes from Link abstraction option in textarea field settings

Posted

I recommend not doing such a hook in the admin as it creates a lot . f problems. If then only on frontend.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...