/** * @param PrepareApiAttributes $event */ public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(DiscussionSerializer::class)) { $event->attributes['isSticky'] = (bool) $event->model->is_sticky; $event->attributes['canSticky'] = (bool) $event->actor->can('sticky', $event->model); } }
public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(ForumSerializer::class)) { $event->attributes['logo_url'] = $this->settings->get('santiagobiali-logo.logo_url'); $event->attributes['logo_css'] = $this->settings->get('santiagobiali-logo.logo_css'); } }
public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(ForumSerializer::class)) { $event->attributes['imgurClientID'] = $this->settings->get('matpompili.imgur-upload.clientID'); $event->attributes['test'] = 'prova'; } }
/** * @param PrepareApiAttributes $event */ public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(DiscussionSerializer::class)) { $event->attributes['isLocked'] = (bool) $event->model->is_locked; $event->attributes['canLock'] = (bool) $event->actor->can('lock', $event->model); } }
/** * Get the setting values from the database and make them available * in the forum. * * @param PrepareApiAttributes $event */ public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(ForumSerializer::class)) { foreach ($this->fieldsToGet as $field) { $event->attributes[$this->packagePrefix . $field] = $this->settings->get($this->packagePrefix . $field); } } }
public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(ForumSerializer::class)) { $event->attributes['imgurClientID'] = $this->settings->get('matpompili.imgur-upload.clientID'); $event->attributes['maxImageWidth'] = $this->settings->get('matpompili.imgur-upload.maxImageWidth'); $event->attributes['maxImageHeight'] = $this->settings->get('matpompili.imgur-upload.maxImageHeight'); } }
/** * @param PrepareApiAttributes $event */ public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(ForumSerializer::class)) { $event->attributes['minPrimaryTags'] = $this->settings->get('flarum-tags.min_primary_tags'); $event->attributes['maxPrimaryTags'] = $this->settings->get('flarum-tags.max_primary_tags'); $event->attributes['minSecondaryTags'] = $this->settings->get('flarum-tags.min_secondary_tags'); $event->attributes['maxSecondaryTags'] = $this->settings->get('flarum-tags.max_secondary_tags'); } }
/** * @param PrepareApiAttributes $event */ public function addApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(DiscussionBasicSerializer::class) || $event->isSerializer(PostBasicSerializer::class)) { $event->attributes['isApproved'] = (bool) $event->model->is_approved; } if ($event->isSerializer(PostSerializer::class)) { $event->attributes['canApprove'] = (bool) $event->actor->can('approvePosts', $event->model->discussion); } }
/** * @param PrepareApiAttributes $event */ public function addAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(UserSerializer::class)) { $canSuspend = $event->actor->can('suspend', $event->model); if ($canSuspend) { $event->attributes['suspendUntil'] = $event->formatDate($event->model->suspend_until); } $event->attributes['canSuspend'] = $canSuspend; } }
/** * @param PrepareApiAttributes $event */ public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(ForumSerializer::class)) { $attributes = array('vovayatsyuk-auth-magento' => array('store_name' => 'Magento', 'background_color' => '#ef672f')); foreach ($attributes as $namespace => $keys) { foreach ($keys as $key => $default) { $event->attributes[$namespace . '.' . $key] = $this->settings->get($namespace . '.' . $key) ?: $default; } } } }
/** * @param PrepareApiAttributes $event */ public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(ForumSerializer::class)) { $event->attributes['canViewModeratorNotes'] = true; $event->attributes['moderatorNotesCount'] = (int) $this->getModeratorNotesCount($event->actor); } if ($event->isSerializer(CurrentUserSerializer::class)) { $event->attributes['newModeratorNotesCount'] = (int) $this->getNewModeratorNotesCount($event->model); } if ($event->isSerializer(PostSerializer::class)) { $event->attributes['canModerateNotes'] = $event->actor->can('moderateNotes', $event->model); } }
/** * @param PrepareApiAttributes $event */ public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(ForumSerializer::class)) { $list = $this->settings->get('avatar4eg.share-social.list') ? json_decode($this->settings->get('avatar4eg.share-social.list')) : []; $list_checked = []; foreach ($list as $item) { if ($this->settings->get('avatar4eg.share-social.' . $item) && (bool) $this->settings->get('avatar4eg.share-social.' . $item) === true) { $list_checked[] = $item; } } $event->attributes['shareSocialButtons'] = json_encode($list_checked); $event->attributes['shareSocialOpenGraph'] = $this->settings->get('avatar4eg.share-social.open_graph'); $event->attributes['shareSocialTwitterCard'] = $this->settings->get('avatar4eg.share-social.twitter_card'); } }
/** * @param PrepareApiAttributes $event */ public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(ForumSerializer::class)) { $event->attributes['canViewFlags'] = $event->actor->hasPermissionLike('discussion.viewFlags'); if ($event->attributes['canViewFlags']) { $event->attributes['flagsCount'] = (int) $this->getFlagsCount($event->actor); } $event->attributes['guidelinesUrl'] = $this->settings->get('flarum-flags.guidelines_url'); } if ($event->isSerializer(CurrentUserSerializer::class)) { $event->attributes['newFlagsCount'] = (int) $this->getNewFlagsCount($event->model); } if ($event->isSerializer(PostSerializer::class)) { $event->attributes['canFlag'] = $event->actor->can('flag', $event->model); } }
/** * Gets the api attributes and makes them available to the forum. * * @param PrepareApiAttributes $event */ public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(ForumSerializer::class)) { $event->attributes['canUploadImages'] = $event->actor->can('flagrow.image.upload'); } }
/** * @param PrepareApiAttributes $event */ public function addAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(ForumSerializer::class)) { $event->attributes['pusherKey'] = $this->settings->get('flarum-pusher.app_key'); } }
public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(ForumSerializer::class)) { $event->attributes['logoURL'] = $this->settings->get('matpompili.login-page.logoURL'); } }
/** * @param PrepareApiAttributes $event */ public function addAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(DiscussionSerializer::class) && ($state = $event->model->state)) { $event->attributes['subscription'] = $state->subscription ?: false; } }
/** * @param PrepareApiAttributes $event */ public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(PostSerializer::class) && $event->actor->can('guard', $event->model)) { $event->attributes['user_ip'] = $event->model->ip_address; } }
public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(ForumSerializer::class)) { $event->attributes['animationtype'] = $this->settings->get('davis.animatedtag.animationtype'); } }
/** * @param PrepareApiAttributes $event */ public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(DiscussionSerializer::class)) { $event->attributes['canTag'] = $event->actor->can('tag', $event->model); } }
/** * @param PrepareApiAttributes $event */ public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(PostSerializer::class)) { $event->attributes['canLike'] = (bool) $event->actor->can('like', $event->model); } }
/** * Gets the api attributes and makes them available to the forum. * * @param PrepareApiAttributes $event */ public function prepareApiAttributes(PrepareApiAttributes $event) { if ($event->isSerializer(ForumSerializer::class)) { $event->attributes['canPostChat'] = $event->actor->can('pushedx.chat.post'); } }