/**
  * @inheritdoc
  */
 public function run()
 {
     if ($this->user->isCurrentUser() || \Yii::$app->user->isGuest) {
         return;
     }
     if (Yii::$app->getModule('friendship')->getIsEnabled()) {
         // Don't show follow button, when friends
         if (Friendship::getFriendsQuery($this->user)->one() !== null) {
             return;
         }
     }
     // Add class for javascript handling
     $this->followOptions['class'] .= ' followButton';
     $this->unfollowOptions['class'] .= ' unfollowButton';
     // Hide inactive button
     if ($this->user->isFollowedByUser()) {
         $this->followOptions['style'] .= ' display:none;';
     } else {
         $this->unfollowOptions['style'] .= ' display:none;';
     }
     // Add UserId Buttons
     $this->followOptions['data-userid'] = $this->user->id;
     $this->unfollowOptions['data-userid'] = $this->user->id;
     $this->view->registerJsFile('@web/resources/user/followButton.js');
     return Html::a($this->unfollowLabel, $this->user->createUrl('/user/profile/unfollow'), $this->unfollowOptions) . Html::a($this->followLabel, $this->user->createUrl('/user/profile/follow'), $this->followOptions);
 }
 /**
  * @inheritdoc
  */
 public function run()
 {
     if ($this->user->isCurrentUser() || \Yii::$app->user->isGuest) {
         return;
     }
     // Add class for javascript handling
     $this->followOptions['class'] .= ' followButton';
     $this->unfollowOptions['class'] .= ' unfollowButton';
     // Hide inactive button
     if ($this->user->isFollowedByUser()) {
         $this->followOptions['style'] .= ' display:none;';
     } else {
         $this->unfollowOptions['style'] .= ' display:none;';
     }
     // Add UserId Buttons
     $this->followOptions['data-userid'] = $this->user->id;
     $this->unfollowOptions['data-userid'] = $this->user->id;
     $this->view->registerJsFile('@web/resources/user/followButton.js');
     return Html::a($this->unfollowLabel, $this->user->createUrl('/user/profile/unfollow'), $this->unfollowOptions) . Html::a($this->followLabel, $this->user->createUrl('/user/profile/follow'), $this->followOptions);
 }