diff --git a/protected/humhub/modules/space/widgets/SpaceChooserItem.php b/protected/humhub/modules/space/widgets/SpaceChooserItem.php
index a9fc4bac91..9482dde8ae 100644
--- a/protected/humhub/modules/space/widgets/SpaceChooserItem.php
+++ b/protected/humhub/modules/space/widgets/SpaceChooserItem.php
@@ -42,26 +42,8 @@ class SpaceChooserItem extends Widget
public function run()
{
- $data = '';
- $badge = '';
-
- /*if ($this->isMember && $this->space->isSpaceOwner()) {
- $badge = '';
- $data = 'data-space-owner';
- }*/
-
- if($this->isMember) {
- $badge = '';
- $data = 'data-space-member';
- } else if($this->isFollowing) {
- $badge = '';
- $data = 'data-space-following';
- } else if($this->space->isArchived()) {
- $badge = '';
- $data = 'data-space-archived';
- } else {
- $data = 'data-space-none';
- }
+ $data = $this->getDataAttribute();
+ $badge = $this->getBadge();
return $this->render('spaceChooserItem', [
'space' => $this->space,
@@ -72,4 +54,27 @@ class SpaceChooserItem extends Widget
]);
}
+ public function getBadge()
+ {
+ if ($this->isMember) {
+ return '';
+ } else if ($this->isFollowing) {
+ return '';
+ } else if ($this->space->isArchived()) {
+ return '';
+ }
+ }
+
+ public function getDataAttribute()
+ {
+ if ($this->isMember) {
+ return 'data-space-member';
+ } else if ($this->isFollowing) {
+ return 'data-space-following';
+ } else if ($this->space->isArchived()) {
+ return 'data-space-archived';
+ } else {
+ return 'data-space-none';
+ }
+ }
}