schmunk42\giiant\generators\crud\providers\core\OptsProvider::columnFormat PHP Method

columnFormat() public method

.]ValueLabel function.
public columnFormat ( $attribute, $model ) : null | string
$model ActiveRecord
return null | string
    public function columnFormat($attribute, $model)
    {
        $modelClass = $this->generator->modelClass;
        $camel_func = 'get' . str_replace(' ', '', ucwords(implode(' ', explode('_', $attribute)))) . 'ValueLabel';
        if (!method_exists($modelClass::className(), $camel_func)) {
            return;
        }
        return <<<EOS
\t\t\t[
                'attribute'=>'{$attribute}',
                'value' => function (\$model) {
                    return {$modelClass}::{$camel_func}(\$model->{$attribute});
                }    
            ]        
EOS;
    }