diff options
Diffstat (limited to 'lib/classes/JsonApi/Schemas/Course.php')
| -rw-r--r-- | lib/classes/JsonApi/Schemas/Course.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/classes/JsonApi/Schemas/Course.php b/lib/classes/JsonApi/Schemas/Course.php index 09f1175..29a0c37 100644 --- a/lib/classes/JsonApi/Schemas/Course.php +++ b/lib/classes/JsonApi/Schemas/Course.php @@ -388,4 +388,29 @@ class Course extends SchemaProvider return array_merge($relationships, [self::REL_STATUS_GROUPS => $relation]); } + + /** + * @inheritdoc + */ + public function hasResourceMeta($resource): bool + { + return true; + } + + /** + * @inheritdoc + */ + public function getResourceMeta($resource) + { + $avatar = \CourseAvatar::getAvatar($resource->id); + + return [ + 'avatar' => [ + 'small' => $avatar->getURL(\Avatar::SMALL), + 'medium' => $avatar->getURL(\Avatar::MEDIUM), + 'normal' => $avatar->getURL(\Avatar::NORMAL), + ], + ]; + } + } |
