Support » Plugin: Pods Gravity Forms Add-On » What GF field is correct for use with a Pods relation field (multy)?

  • Hello. Could you please help me to solve next problem.
    Below is not an actual example but just an attempt of a simple illustration of my problem.

    I have two ACT pods, let say ‘films’ and ‘actors’. I may store variable qty of actors in ‘films’->’actor’ relation field.

    When create new ‘film’ item from the back-end and add actors in relation field everything works fine. For the same purpose I’ve decided to make front-end form using GF and Pods GF Add-on.

    In GF form I created repeatable ‘List field’ (from ‘Advanced Fields’ section) called ‘Actors’. Then I created Pods Feed and mapped GF field ‘Actors’ with pod’s ‘actors’->’name’ field. GF ‘List Field’ actually is not a selection field. And it is ok. Because I have a very large list of ‘actors’ in table and more preferably copy-paste their slug’s into this field instead of using multy selection field. I added several actors such way and submitted the form.

    After I get the error: array_keys() expects parameter 1 to be array, string given in …\Pods_GF.php on line 3521

    What I’m doing wrong way and what GF field you can advise to use in such case?

    Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Uncle Matt

    (@uncle-matt)

    It is very sad that the developers do not have time to answer on user’s questions, especially taking into account the lack of manuals.

    I’m not a programmer but I have found the solution by investigating source code. Developers have declared functionality of GF List Fields for relation fields. In order to use this advanced option:
    – you have to use GF <Advanced Fields> -> <List Field>;
    – you must switch on ‘Enable multiple columns’ and leave at least one of them (it is very strange demand if you use only one relation field);
    – if you would like to put into the field name (or slug) of related pod you have to use ‘pods_gf_field_column_row_’ hook and handle it manually;
    – you have to remember that according to Pods GF Add-on’s current algorithm if List Field contains data but related pod item is not found new item will be created anyway (even you I don’t need this). So you have to handle such situation.

    Hope this information will be useful for some users.

    Plugin Author Jim True

    (@jimtrue)

    Many apologies that we were not able to respond to your question before you solved it yourself. Blame it on a timing issue: we just released the list field support for related items in this most recent 1.4 release. We are still working on the documentation for this feature since it is brand new and the filters to provide alternate field support is completely brand new and undocumented.

    For your fastest support, especially when you’re using something cutting edge is on our Slack Chat at https://pods.io/chat/ Our developer for this feature has a full time job that isn’t this plugin, so we have to rely on yiur patience for responses, especially since it’s a free plugin.

    I’ll reach out to the developer and see if he can respond to your concerns directly.

    Plugin Author Jim True

    (@jimtrue)

    Another note. If you’re not adding new entries into the related record, you should use the standard multiple select or checkbox field for your actors and select dynamically populate from the matched field in the feed. The list field support is very new to our plugin, so any suggestions for enhancement or bugs should be reported to our GitHub https://github.com/pods-framework/pods-gravity-forms/issues/new

    Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    Sorry, when I built this functionality it was only for multiple columns. I never tested it against single column list fields. That’s my bad, I just didn’t have it in my testing plan.

    Thread Starter Uncle Matt

    (@uncle-matt)

    Thank you for your response. Concerning support of free plugin I have a clear understanding. From this point I have no claims but just a little bit being sad.

    You have created very useful tool and of course users who deep dived into Pods are expected from it more and more options. 🙂

    I’m sure that the best way to learn programming is to investigate someone’s well done code. That’s why I’m even thankful to you. Оwing to you I’ve done a big jump in php programming.

    But on the case…

    The example with films and actors is just for ease explanations of the issue. I have a huge amount of ‘actors’. So multiple select or checkbox is not my choice. I’d like to put into the list field text value ‘title’ or ‘slug’ and then find related pod by this parameters. I’ve already done this such way:

    
    add_filter( 'pods_gf_field_column_row_2_3', 'my_function', 10, 6 );
    
    function my_function($row, $columns, $form, $gf_field, $options, $related_obj) {
      
      $params = array( 'where' => 't.name = "'.$row['name'].'"');
      $item = $related_obj->find($params);
      $item_id = $iem->first_id();
      $row['id'] =  $item;
      return $row;
    }
    

    Unfortunately when I mapped pods field to GF List field there is no [‘id’] key appeared and I had to add it manually.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘What GF field is correct for use with a Pods relation field (multy)?’ is closed to new replies.