MarkE Posted June 22 Share Posted June 22 I'm puzzled. Last night I thought I had a nice working pair of hooks - see here: Today it is not working. I put a bd in the hook before Page::moveable and I get 18 instances of the page being 'page' when viewing the page tree. I put in a bd(Debug::backtrace(), 'backtrace'); and I get another 18 instances of this: so the hook seems to be called (only) by Tracy. What is going on? Link to comment Share on other sites More sharing options...
adrian Posted June 24 Share Posted June 24 Hi @MarkE - sorry, I am really not following what you mean by the hook only called by Tracy. Can you provide a complete example to test? Link to comment Share on other sites More sharing options...
MarkE Posted June 24 Author Share Posted June 24 7 hours ago, adrian said: I am really not following what you mean Sorry - maybe I confused things by providing the context: that was just an explanation as to why I added a bd to the hook (to try and understand how it was being triggered). I was then puzzled that Tracy appears to call it multiple times - in my case 16 exact same repetitions. 7 hours ago, adrian said: Can you provide a complete example to test? Try this in ready.php wire()->addHookBefore('Page::moveable', function(HookEvent $event) { $page = $event->object; bd($page, 'page'); bd(Debug::backtrace(), 'backtrace'); }); Then open the page tree. Tracy appears to call the hook multiple times for page id 3 ('page'), but I don't understand why. In my case I got 16 of the dumps illustrated in my OP. Link to comment Share on other sites More sharing options...
adrian Posted June 24 Share Posted June 24 Tracy's RequestInfo panel has a PagePermissions section which checks the permissions for the current user and each role. One of the permissions it checks is "moveable". If you don't want these calls to happen you can disable this section in Tracy's settings. 2 Link to comment Share on other sites More sharing options...
MarkE Posted June 25 Author Share Posted June 25 14 hours ago, adrian said: Tracy's RequestInfo panel has a PagePermissions section which checks the permissions for the current user and each role Thanks @adrian. There's so much in Tracy that I still haven't fully explored. That actually seems a really useful feature. Now I understand why it's called 16 times - because my site has 16 roles (which needs a bit of rationalisation, I think!). 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now