publicForm
(Since 1.2.0) -- display input forms on your public site
function publicForm($public_columns = null, $label = 'Save changes')Pods gives you the ability to display input forms on your site. This lets normal users add content to your site.
Parameters
| Parameter | Type | Details |
|---|---|---|
| $public_columns | ARRAY | An associative array of columns and properties (see examples) |
| $label | STRING | (optional) the submit button label |
Examples
Adding New Pod Items
Just load the pod you want to use, and call the publicForm() function. Unless you specify columns to use, all columns will appear by default.
<?php
$Record = new Pod('pod_name');
echo $Record->publicForm();
?>
Editing Existing Pod Items
<?php
$Record = new Pod('pod_name', $id_or_slug);
echo $Record->publicForm();
?>
Customizing which input fields should appear
<?php
$Record = new Pod('pod_name');
$fields = array('name', 'body', 'start_date');
echo $Record->publicForm($fields);
?>
Each column can optionally be an array of settings. They will override the default settings for the column. Available settings:
- default
- hidden
- label
- comment
- input_helper
<?php
$fields = array(
'name',
'body',
'start_date' => array('input_helper' => 'fancy_date_picker'),
'slug' => array('hidden' => true)
);
?>
