Display Helpers
(Since 1.2.0) -- modify column values before output
A Display Helper lets you modify a column value before output. It doesn't make any changes to the database.
How to Assign
- From within a Pod Template using Magic Tags, e.g. {@date, format_date}
- From within a Pod Template using PHP, e.g. $this->pod_helper('format_date', $this->get_field('date'));
- From within a Pod Page (or anywhere else) using PHP, e. g. $pods->pod_helper('format_date', $pods->get_field('date'));
- When adding or editing a Pod column, there is a "Display Helper" dropdown
Usage
- From the Pods control panel, navigate to Setup > Helpers and click the "Add New Helper" button to begin
- Helper names may contain only alphanumeric characters and the underscore character (no whitespace)
- In the blank edit field that appears, enter any PHP code
- Pods will pass the column values as $value - your code should manipulate this variable to change the display of individual pod fields.
Examples
The following code may be used to output the contents of multiple PICK column values as list items:
<?php
if ($value)
{
foreach ($value as $v)
{
echo '
<?php
if ($value)
{
$out = array();
foreach ($value as $v)
{
$out[] = $v['name'];
}
echo implode(', ', $out);
}
?>
