1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace Cube\View\Helper;
- class FieldDisplay extends AbstractHelper
- {
- const DISPLAY_FALSE = 'n/a';
- const IMPLODE_GLUE = ', ';
-
- public function fieldDisplay($field, $true = null, $false = null, $glue = null)
- {
- $glue = ($glue !== null) ? (string)$glue : self::IMPLODE_GLUE;
- if ($field) {
- if (is_array($field)) {
- return (implode($glue, $field));
- }
- if (($array = @unserialize(html_entity_decode($field))) !== false) {
- return implode($glue, $array);
- }
- return ($true === null) ? $field : $true;
- }
- else {
- return ($false === null) ? self::DISPLAY_FALSE : $false;
- }
- }
- }
|