Skip to content

[FR] Add Owner to 'Default Table Columns' in Custom Sources #15230

Closed Answered by brandonkelly
shifuma asked this question in Ideas
Discussion options

You must be logged in to vote

That’s a little tricky, because the owners could span across multiple element types, so we don’t currently have a way to eager-load them.

If you don’t mind the performance hit, you could add the column yourself by adding this code to a module’s init() method:

use craft\base\Element;
use craft\elements\Entry;
use craft\events\DefineAttributeHtmlEvent;
use craft\events\RegisterElementTableAttributesEvent;
use craft\helpers\Cp;
use yii\base\Event;

Event::on(
    Entry::class,
    Element::EVENT_REGISTER_TABLE_ATTRIBUTES,
    function(RegisterElementTableAttributesEvent $event) {
        $event->tableAttributes['owner'] = ['label' => 'Owner'];
    },
);

Event::on(
    Entry::class,
    Element

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@mmikkel
Comment options

Answer selected by brandonkelly
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
3 participants