This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

g.vanto67453
g.vanto67453

Is it possible to have a callback/way to output custom output for field value? In this instance I'd like to show the name of the referrer (also a user):

UserController::extendListColumns(function ($list, $model) {
if (!$model instanceof User) {
return;
}

        $list->addColumns([
            'referrer_id' => [
                'label' => 'Referrer',
                //possible to add a mutator function to say output a link / manipulate value?
            ],
        ]);
    });

Last updated

daftspunky
daftspunky

Hey g,

Take a look at the type => 'partial' column type. This will let you reference a partial view file where you can manipulate the value and add a link, etc.

https://octobercms.com/docs/backend/lists#column-partial

Hope this helps!

g.vanto67453
g.vanto67453

Thanks Sam, that works great!

One other thing I'm trying to figure out is how to get (custom) column 'id' to display as the very first column (ie most left). I've had a look at https://octobercms.com/docs/api/backend/classes/listcolumn but can't seem to see a 'position' (or similar) type config attribute. I think I saw a post on SO somewhere about this but can't find it anymore urgh

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.