src/ORM/DataObject.php
public function fieldLabels($includerelations = true)
    {
        $cacheKey = static::class . '_' . $includerelations;

        if (!isset(self::$_cache_field_labels[$cacheKey])) {
            $customLabels = $this->config()->get('field_labels');
            $autoLabels = array();

            // get all translated static properties as defined in i18nCollectStatics()
            $ancestry = ClassInfo::ancestry(static::class);
            $ancestry = array_reverse($ancestry);
            if ($ancestry) {
                foreach ($ancestry as $ancestorClass) {
                    if ($ancestorClass === ViewableData::class) {
                        break;
                    }
                    $types = [
                        'db' => (array)Config::inst()->get($ancestorClass, 'db', Config::UNINHERITED)
                    ];
                    if ($includerelations) {
                        $types['has_one'] = (array)Config::inst()->get($ancestorClass, 'has_one', Config::UNINHERITED);
                        $types['has_many'] = (array)Config::inst()->get(
                            $ancestorClass,
                            'has_many',
                            Config::UNINHERITED
                        );
                        $types['many_many'] = (array)Config::inst()->get(
                            $ancestorClass,
                            'many_many',
                            Config::UNINHERITED
                        );
                        $types['belongs_many_many'] = (array)Config::inst()->get(
                            $ancestorClass,
                            'belongs_many_many',
                            Config::UNINHERITED
                        );
                    }
                    foreach ($types as $type => $attrs) {
                        foreach ($attrs as $name => $spec) {
                            $autoLabels[$name] = _t(
                                "{$ancestorClass}.{$type}_{$name}",
                                FormField::name_to_label($name)
                            );
                        }
                    }
                }
            }

            $labels = array_merge((array)$autoLabels, (array)$customLabels);
            $this->extend('updateFieldLabels', $labels);
            self::$_cache_field_labels[$cacheKey] = $labels;
        }

        return self::$_cache_field_labels[$cacheKey];
    }
public function fieldLabels($includerelations = true)
    {
        $cacheKey = static::class . '_' . $includerelations;

        if (!isset(self::$_cache_field_labels[$cacheKey])) {
            $customLabels = $this->config()->get('field_labels');
            $autoLabels = array();

            // get all translated static properties as defined in i18nCollectStatics()
            $ancestry = ClassInfo::ancestry(static::class);
            $ancestry = array_reverse($ancestry);
            if ($ancestry) {
                foreach ($ancestry as $ancestorClass) {
                    if ($ancestorClass === ViewableData::class) {
                        break;
                    }
                    $types = [
                        'db' => (array)Config::inst()->get($ancestorClass, 'db', Config::UNINHERITED)
                    ];
                    if ($includerelations) {
                        $types['has_one'] = (array)Config::inst()->get($ancestorClass, 'has_one', Config::UNINHERITED);
                        $types['has_many'] = (array)Config::inst()->get(
                            $ancestorClass,
                            'has_many',
                            Config::UNINHERITED
                        );
                        $types['many_many'] = (array)Config::inst()->get(
                            $ancestorClass,
                            'many_many',
                            Config::UNINHERITED
                        );
                        $types['belongs_many_many'] = (array)Config::inst()->get(
                            $ancestorClass,
                            'belongs_many_many',
                            Config::UNINHERITED
                        );
                    }
                    foreach ($types as $type => $attrs) {
                        foreach ($attrs as $name => $spec) {
                            $autoLabels[$name] = _t(
                                "{$ancestorClass}.{$type}_{$name}",
                                FormField::name_to_label($name)
                            );
                        }
                    }
                }
            }

            $labels = array_merge((array)$autoLabels, (array)$customLabels);
            $this->extend('updateFieldLabels', $labels);
            self::$_cache_field_labels[$cacheKey] = $labels;
        }

        return self::$_cache_field_labels[$cacheKey];
    }
public function fieldLabels ( $ includerelations = true ) { $ cacheKey = static :: class . '_' . $ includerelations ; if ( ! isset ( self :: $ _cache_field_labels [ $ cacheKey ] ) ) { $ customLabels = $ this -> config ( ) -> get ( 'field_labels' ) ; $ autoLabels = array ( ) ; // get all translated static properties as defined in i18nCollectStatics() $ ancestry = ClassInfo :: ancestry ( static :: class ) ; $ ancestry = array_reverse ( $ ancestry ) ; if ( $ ancestry ) { foreach ( $ ancestry as $ ancestorClass ) { if ( $ ancestorClass === ViewableData :: class ) { break ; } $ types = [ 'db' => ( array ) Config :: inst ( ) -> get ( $ ancestorClass , 'db' , Config :: UNINHERITED ) ] ; if ( $ includerelations ) { $ types [ 'has_one' ] = ( array ) Config :: inst ( ) -> get ( $ ancestorClass , 'has_one' , Config :: UNINHERITED ) ; $ types [ 'has_many' ] = ( array ) Config :: inst ( ) -> get ( $ ancestorClass , 'has_many' , Config :: UNINHERITED ) ; $ types [ 'many_many' ] = ( array ) Config :: inst ( ) -> get ( $ ancestorClass , 'many_many' , Config :: UNINHERITED ) ; $ types [ 'belongs_many_many' ] = ( array ) Config :: inst ( ) -> get ( $ ancestorClass , 'belongs_many_many' , Config :: UNINHERITED ) ; } foreach ( $ types as $ type => $ attrs ) { foreach ( $ attrs as $ name => $ spec ) { $ autoLabels [ $ name ] = _t ( "{$ancestorClass}.{$type}_{$name}" , FormField :: name_to_label ( $ name ) ) ; } } } } $ labels = array_merge ( ( array ) $ autoLabels , ( array ) $ customLabels ) ; $ this -> extend ( 'updateFieldLabels' , $ labels ) ; self :: $ _cache_field_labels [ $ cacheKey ] = $ labels ; } return self :: $ _cache_field_labels [ $ cacheKey ] ; }
Get any user defined searchable fields labels that
exist. Allows overriding of default field names in the form
interface actually presented to the user.

The reason for keeping this separate from searchable_fields,
which would be a logical place for this functionality, is to
avoid bloating and complicating the configuration array. Currently
much of this system is based on sensible defaults, and this property
would generally only be set in the case of more complex relationships
between data object being required in the search interface.

Generates labels based on name of the field itself, if no static property
{@link self::field_labels} exists.

@uses $field_labels
@uses FormField::name_to_label()

@param boolean $includerelations a boolean value to indicate if the labels returned include relation fields

@return array Array of all element labels
Get any user defined searchable fields labels that exist . Allows overriding of default field names in the form interface actually presented to the user .