Version 4.7.6
This commit is contained in:
1 parent
8ba7d43898
commit
7b7404e741
1085 files changed
+30590
-7837
No files matched your search
@@ -768,20 +768,33 @@ abstract class _ActiveRecord
|
||||
*/
|
||||
public function coverPhoto()
|
||||
{
|
||||
$photoCol = static::$databaseColumnMap[ 'cover_photo' ];
|
||||
$photoOffset = static::$databaseColumnMap[ 'cover_photo_offset' ];
|
||||
$photo = new \IPS\Helpers\CoverPhoto;
|
||||
if ( isset( static::$databaseColumnMap['cover_photo'] ) and $this->$photoCol )
|
||||
{
|
||||
$photo->file = \IPS\File::get( static::$coverPhotoStorageExtension, $this->$photoCol );
|
||||
$photo->offset = $this->$photoOffset;
|
||||
}
|
||||
|
||||
$photo->editable = $this->canEdit();
|
||||
$photo->object = $this;
|
||||
|
||||
return $photo;
|
||||
$photo = new \IPS\Helpers\CoverPhoto;
|
||||
if( $file = $this->coverPhotoFile() )
|
||||
{
|
||||
$photoOffset = static::$databaseColumnMap[ 'cover_photo_offset' ];
|
||||
$photo->file = $file;
|
||||
$photo->offset = $this->$photoOffset;
|
||||
}
|
||||
$photo->editable = $this->canEdit();
|
||||
$photo->object = $this;
|
||||
return $photo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the CoverPhoto File Instance or NULL if there's none
|
||||
*
|
||||
* @return null|\IPS\File
|
||||
*/
|
||||
public function coverPhotoFile() : ?\IPS\File
|
||||
{
|
||||
$photoCol = static::$databaseColumnMap[ 'cover_photo' ];
|
||||
|
||||
if ( isset( static::$databaseColumnMap['cover_photo'] ) and $this->$photoCol )
|
||||
{
|
||||
return \IPS\File::get( static::$coverPhotoStorageExtension, $this->$photoCol );
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce a random hex color for a background
|
||||
|
||||
Reference in new issue
Block a user