Will there be docs to do a full PODs plugin in PHP? (a zip file like typical WP plugins…)

This topic is: not resolved

This topic contains 7 replies, has 4 voices, and was last updated by  Ben Petersen 2 years, 7 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #164392

    Ben Petersen
    Member

    Greetings!

    I love how much can be done with PODs. I am wondering though if it is possible to work with Helpers, Pages, Roles and all in PHP. The idea would be to have a fully installable PODs plugin as a zipped file, like most WordPress Plugins. The only catch would be that it would require PODs/PODs-UI already installed.

    I don’t mind the package manager built in, its handy as well. I’m just looking for the most portable possibilities for making a PODs plugin installable (and not need extra configuration steps… like setting up a pods page in admin, or setting up a helper).

    So hopefully that is clear. Good examples again:

    • Create & package helpers as PHP files in your plugin folder
    • Create POD page defaults in a php file…. though probably good if can be edited later
    • etc.

    Thanks!—

    #164393

    if you install the PODS UI plugin and look at the sample, you’ll find that creating a PODs plugin is pretty easy.

    #164394

    Ben Petersen
    Member

    Thanks, I’m in that, and a ways past actually. I’ve got a pretty good plugin going after checking out the PODs-UI sample code. In the code though, there is no reference of helper functions in the php file.

    Ive installed some of the packages here (the thumbnail image is really handy) but these all go into the PODs admin area (database). I’m looking for docs on the same kind of functionality, but that could simply be implemented though the php files in my plugin.

    Thanks!

    #164395

    Ben Petersen
    Member

    Preface — Pods is awesome. I’m definitely not knocking or assuming any thoughts here are "improvements". Just probing beyond documentation to see what is possible.

    My pretend code below is purely theoretical, nothing below actually works, but helps clarify my question. Hopefully WordPress won’t reformat it too much after I hit submit.

    /// my php plugin file /////////////////

    // setup my helper in code…
    function my_helper() {
    // do helper stuff
    }

    // now register the helper for use (by any pod)

    register_pods_helper(
    array(
    ‘name’ => ‘my_helper’,
    ‘type’ => ‘display_helper’
    )
    );

    // then later when I use pods-ui, I’d like to pass it into the array

    function members_profiles_page()
    {
    $object = new Pod(‘members’);
    $object->ui = array(
    ‘title’ => ‘Members’,
    ‘columns’ => array(
    ‘image_mug_shot’=> array(‘label’=>’Mug Shot’,'display_helper’=>’my_helper’ ),

    }

    Perhaps that provides some clarity. I know for ‘columns’ you can define ‘display_helper’ as I did above, but I don’t know yet if there is a way to register the helper first in php world. That would make the pod plugin extra portable.

    Another example would be to define default urls, or templates… again this doesn’t exist, I’m just using it to outline what I’d like to do.

    $object = new Pod(‘members’);

    $add_pods_page = "members/*"; // default pods page for this plugin?

    $add_pods_template = "path/to/templates/members_list.php" // a default php file with a list template defined
    $add_pods_template_single = "path/to/template/member_single.php" // a default for viewing a single item

    The idea again would be to provide users with default templates…. savvy users would probably go into the code & copy it into their theme file to tweak to their own likings.

    I don’t know if that is really helpful or not, but there is the goal. I’m going to dig through the code and if I answer my own questions I will post back here. I’m guessing there are others looking for the same or similar things!

    Thanks again guys. Pods is sweet.

    #164396

    Ben,

    There is definitely a way to do this using what is available now. Once again refer back to the PODS ui sample plugin. You’ll notice that when the plugin installs itself it creates a whole bunch of PODS. This is accomplished by having the plugin do a package import. With that said, you can do a package import of any POD type item including pages, templates and helpers. This way, you’ll be able to register your helper in the PHP world first.

    at the bottom of the sample plugin, you notice this code

    And there it is!! Everything you need! Hope you find this helpful!

    #164397

    sc0ttkclark
    Keymaster
    Post count: 813

    We’re hoping to get a bit more Package functionality into Pods 2.0, but if not 2.0 then the version right after. The new functionality would include the ability to import packages and overwrite the existing helpers / pages / etc – and the ability to upgrade your package and uninstall it. Lots of cool stuff, keep your eyes peeled!

    #164398

    benfavre
    Participant

    I have done such a thing for http://www.armen.net/gps/ (pretty involved) basically on activation i import the pods and helpers like chriscarvache suggested. But then all the rewrites are registered by my plugin without going through pods. This is done verry easily with a bit of php. This allowed me to have all my php pod pages sit in a directory in my plugin dir. This worked really well for me and i would be willing to share the code with you if you really wanna go down that route.

    In the end: I wanted to do it, so i figured out a way … But now i wonder if it was really necessary. I does help to be able to edit the files in your php editor with syntax higlighting and maybe it feels more like a plugin by having code other than the podsui code in the dir :D . But appart from that at the end of the day pods has a (sort of) nice way of dealling with imports etc.

    If you put in a bit of effort like chriscarvache said : the way it is now works.
    And as sc0ttkclark said it’s gonna be improved.

    #164399

    Ben Petersen
    Member

    Excellent!
    Thanks Chris for your answer… I did miss that chunk of code at the bottom, which is exactly what i am looking for. Scott, I’ve been reading what you guys have coming in 2.0 (& beyond) and am quite excited. And thanks for your help as well gr0b1.

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

You must be logged in to reply to this topic.

Wordpress Cloud Hosting