Update README.md

Added canEdit check in BetterNavigatorEditLink example.

Co-authored-by: Jono Menz <jonomenz@gmail.com>
This commit is contained in:
James Cocker 2021-09-09 18:18:47 +01:00 committed by GitHub
parent fffb43cc2f
commit f431417fd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -94,7 +94,8 @@ There may be occasions when you wish to override the "Edit in CMS" link. For exa
*/
public function BetterNavigatorEditLink()
{
return CMSEditLinkAPI::find_edit_link_for_object($this->displayedEvent());
$event = $this->displayedEvent();
return $event->canEdit() ? CMSEditLinkAPI::find_edit_link_for_object($event) : false;
}
````