Software note: Pods CMS Version 1.7.3 / WP 2.8.4
Documentation: http://pods.uproot.us/codex/helpers
What are Input Helpers
An Input Helper lets you completely customize the appearance of any input field… when adding new data contents.
In plain n00b English: as an example, the default field “name” I had it to store last names, and a separate column to store first names (fname). The problem of that would be when you’re using Bi-directional relationship PICK column to another Pod (let’s call this: Person) is you can only relate one of the columns, not both First Name and Last Name. So if you use the PICK column the “name”; which stores the Last Names, and with the last name like Johnson – you probably can’t tell which Johnson that is. Input Helpers can grab and display the full names for you when you’re adding data. See screenshot:

How to add a new Input Helper

Customized Dropdown Input Helper
The following refers back to the example and screenshot above where it pulls full names from the “name” and “fname”columns as a PICK column to display as a drop down menu:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <select class="form pick1 <?php echo $name; ?>"> <option value="">-- Select one --</option> <?php if (!empty($value)) { foreach ($value as $key => $val) { $lastname = $val['name']; $firstname = $val['firstname']; $fullname = $lastname.", ".$firstname; $selected = empty($val['active']) ? '' : ' selected'; ?> <option value="<?php echo $val['id']; ?>"<?php echo $selected; ?>><?php echo $fullname; ?></option> <?php } } ?> </select> |
The crucial parts:
<select class="form pick1 <?php echo $name; ?>">
The class “form pick1″ are required by the default CSS unless you don’t care about the CSS. The $name is just an column’s name to identify the column’s name. Just like Display Helper, it passes the $value array for you to manipulate. The rest of the codes are very straight forward to read through the $value array, make sure that it actually have something in it before reading it. Then split it in parts to display. The $select is simply default select whatever previous selected when you are browsing existing content. If you’re adding new content, it is default to “–Select one–”. The very last part of this script is just simply displaying each option, giving each of them their unique row ID, then finally displaying the full names.
Another one I ran into was when I want to do a Multi PICK column, such as people who belong to a Dojo or Federation. See below:

I referenced the code above, with the help of FireBug, this saved the day:
Customized Multi PICK Column Input Helper
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <div class="form pick <?php echo $name; ?>"> <?php if (!empty($value)) { foreach ($value as $key => $val) { $lastname = $val['name']; $firstname = $val['firstname']; $fullname = $lastname.", ".$firstname; $active= empty($val['active']) ? '' : ' active'; ?> <div class="option<?php echo $active; ?>" value="<?php echo $val['id']; ?>"><?php echo $fullname ; ?></div> <?php } } ?> </div> |
As you’ve noticed, there are only minor differences between the two. The differences are “div” instead of “select”, $active, and the very last line (line 12). Obviously the very last line is the default CSS that used by Pods CMS for Multi PICK columns, unless you want something different.
Using the helpers
Simply click on the pencil/Edit icon of the column, and choose the helper. Like this:

Well, that’s it for now. I’ll update this section if I learn more.
Related Posts
No related posts.
No Responses to “Pods CMS — Input Helpers”