forked from humhub/content-bookmarks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Module.php
33 lines (26 loc) · 891 Bytes
/
Module.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2021 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\contentBookmarks;
use humhub\modules\content\components\ContentActiveRecord;
use humhub\modules\content\models\Content;
use humhub\modules\contentBookmarks\models\BookmarkableContent;
class Module extends \humhub\components\Module
{
public $resourcesPath = 'resources';
/**
* @param ContentActiveRecord $record
* @return bool
*/
public function isBookmarkedRecord($record)
{
if (!($record->content instanceof Content) || $record->content->isNewRecord) {
return false;
}
$bookmarkableContent = BookmarkableContent::findOne(['id' => $record->content->id]);
return $bookmarkableContent && $bookmarkableContent->isBookmarked();
}
}