Skip to content

Commit

Permalink
Added getAuthor method so you don't need to add it to the object
Browse files Browse the repository at this point in the history
  • Loading branch information
gorriecoe committed Apr 13, 2018
1 parent 61a8da9 commit d5fea84
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/extensions/DataObjectHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
use SilverStripe\Forms\GridField\GridFieldPageCount;
use SilverStripe\Forms\GridField\GridFieldToolbarHeader;
use SilverStripe\Forms\GridField\GridFieldSortableHeader;
use Symbiote\GridFieldExtensions\GridFieldTitleHeader;
use SilverStripe\Forms\GridField\GridFieldDetailForm;
use SilverStripe\Forms\GridField\GridFieldDataColumns;
use SilverStripe\Forms\GridField\GridFieldPaginator;
use SilverStripe\Forms\GridField\GridFieldViewButton;
use SilverStripe\Security\Member;
use SilverStripe\Versioned\Versioned;
use Symbiote\GridFieldExtensions\GridFieldTitleHeader;
use gorriecoe\DataObjectHistory\Forms\GridFieldHistoryButton;
use gorriecoe\DataObjectHistory\Forms\HistoryGridFieldItemRequest;
use SilverStripe\Versioned\Versioned;

/**
* DataObjectHistory
Expand Down Expand Up @@ -87,4 +88,16 @@ public function getHistoryFields()
->addExtraClass('grid-field--history')
);
}

/**
* @return Member
*/
public function getAuthor()
{
$owner = $this->owner;
if ($owner->AuthorID) {
return Member::get()->byId($owner->AuthorID);
}
return null;
}
}

0 comments on commit d5fea84

Please sign in to comment.