mootensai\enhancedgii\crud\Generator::generateSearchLabels PHP Method

generateSearchLabels() public method

Generates the attribute labels for the search model.
public generateSearchLabels ( ) : array
return array the generated attribute labels (name => label)
    public function generateSearchLabels()
    {
        /* @var $model Model */
        $model = new $this->modelClass();
        $attributeLabels = $model->attributeLabels();
        $labels = [];
        foreach ($this->getColumnNames() as $name) {
            if (isset($attributeLabels[$name])) {
                $labels[$name] = $attributeLabels[$name];
            } else {
                if (!strcasecmp($name, 'id')) {
                    $labels[$name] = 'ID';
                } else {
                    $label = Inflector::camel2words($name);
                    if (!empty($label) && substr_compare($label, ' id', -3, 3, true) === 0) {
                        $label = substr($label, 0, -3) . ' ID';
                    }
                    $labels[$name] = $label;
                }
            }
        }
        return $labels;
    }