post-save helpers, helper debugging, including helpers as file and other questions

This topic is: not resolved

This topic contains 2 replies, has 1 voice, and was last updated by  Kamil Grzegorczyk (Owi) 2 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #165223

    Kamil Grzegorczyk (Owi)
    Participant
    Post count: 14

    Hello,

    I have few questions which i didnt find an answer for by looking through almost everything I was able to find in documentation or forums.

    1. Can i call some functions from functions.php or from some plugin inside of helpers or can i just include them?
    2. Can I call function as a post-save helper from pods UI function? Like adding some parameter to $object->ui which will fire function on save (function not pod helper)?
    3. Is there a way to see php errors generated by helpers? Debug it somehow using functions like vardump, print_r?

    I would like to build a little bit complicated post-save helper which updates another pod and generates some logs. Its very hard to do it without some response from pods. For example if i type die() inside of a helper I would expect some error displayed in admin area (or even just blank page) but of course nothing happens (for example pod is not saved but page works fine). i know that this is because pods uses ajax heavily but is there a way to help in developement process by swicthing off some things?

    I would like to now if somebody found some solution for such situation, got around that.
    The only thing which comes to my mind is trying to play with pods cms plug but I want to find easiest way to not interfere with pods itself

    Best Regards
    Kamil

    #165224

    Kamil Grzegorczyk (Owi)
    Participant
    Post count: 14

    I managed to display some debug errors using such solution:

    Maybe this will help someone who would like to debug something also (of course when they are adding pods through admin area)

    #165225

    Kamil Grzegorczyk (Owi)
    Participant
    Post count: 14

    OKay I found a solution for another thing – I played around Pods CMS and UI code (ui is just terrible, no comments, no good code formatting but I understand that it is not some main plug).

    I would like to share solution to help other ppl having such ideas ;)

    Basically whole process is very easy.

    1. Create a file inside our custom plugin directory (i presume that You are using PODS UI to create some custom environment) called helper.php which contains Your function declarations or other stuff
    2. Next we create post-save helper and assigning that to particular POD

    3. Now we can work on our helper inside our favourite IDE like Dreamveawer or whaever You prefer.

    4. As pods heavily uses ajax to call pods api methods in order to see php errors please use Firebug addon to firefox, switch to console tab – You can view php error in response tab of AJAX call.

    helper.php

    If You dont want to play with firebug go to pods/ui/js/pods.ui.js and change this

    to this

    And all php parse errors will be prompted as an alert :)

    Those methods should work with every type of helper. It should be helpful if You are trying to build some more complicated stuff.

    Of course Im awaiting for responds from more experienced pods users – maybe Im overcomplicating everything :)

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Wordpress Cloud Hosting