Pods::display PHP Метод

display() публичный Метод

Return the output for a field. If you want the raw value for use in PHP for custom manipulation, you will want to use field() instead. This function will automatically convert arrays into a list of text such as "Rick, John, and Gary"
С версии: 2.0
public display ( string | array $name, boolean $single = null ) : string | null | false
$name string | array The field name, or an associative array of parameters
$single boolean (optional) For tableless fields, to return an array or the first
Результат string | null | false The output from the field, null if the field doesn't exist, false if no value returned for tableless fields
    public function display($name, $single = null)
    {
        $defaults = array('name' => $name, 'single' => $single, 'display' => true, 'serial_params' => null);
        if (is_array($name) || is_object($name)) {
            $defaults['name'] = null;
            $params = (object) array_merge($defaults, (array) $name);
        } elseif (is_array($single) || is_object($single)) {
            $defaults['single'] = null;
            $params = (object) array_merge($defaults, (array) $single);
        } else {
            $params = $defaults;
        }
        $params = (object) $params;
        $value = $this->field($params);
        if (is_array($value)) {
            $fields = $this->fields;
            if (isset($this->pod_data['object_fields'])) {
                $fields = array_merge($fields, $this->pod_data['object_fields']);
            }
            $serial_params = array('field' => $params->name, 'fields' => $fields);
            if (!empty($params->serial_params) && is_array($params->serial_params)) {
                $serial_params = array_merge($serial_params, $params->serial_params);
            }
            $value = pods_serial_comma($value, $serial_params);
        }
        return $value;
    }