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

benm
benm

My issue is that I'm trying to add a simple 'View Post' link to the backend list view of the Rainlab Blog. I've extended it with my own plugin and in the boot() method I have a PostModel::extend(); where I put the following:

    PostsController::extendListColumns(function($list, $model) {
        \Debugbar::info($list);
        $list->addColumns([
            'View' => [
                'label' => 'View',
                'default' => '<a href="/blog/post/my-post-slug" target="_blank">view</a>',
                'clickable' => false
            ]
        ]);
    });

The 'clickable' is set to false to prevent it from going to the update form with you click 'View'. Putting a test link in the href works fine. The thing is that I want to retrieve the slug for each post and populate the default value with that link.

How do I get the slug it within this context? Do I have to add a 'slug' column in the extended plugin table and populate it for this exclusive use? If that was even possible it seems pretty absurd. There's got to be a simple way for such a simple use case?!

1-1 of 1

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