rgsystemes/uservoice-bundle

此包已被废弃,不再维护。未建议替代包。

轻松将UserVoice集成到您的Symfony2项目中

安装次数: 4,198

依赖者: 0

建议者: 0

安全性: 0

星标: 1

关注者: 1

分支: 2

开放问题: 0

类型:symfony-bundle

dev-master 2017-03-09 10:11 UTC

This package is auto-updated.

Last update: 2020-01-16 10:46:20 UTC


README

轻松将UserVoice集成到您的Symfony2项目中。

安装

  1. 使用vendors脚本将此bundle添加到您的vendor/目录
Add the following to your `composer.json`:

    "rgsystemes/uservoice-bundle": "dev-master"

and run:

    php composer.phar install

The bundle is compatible with Symfony 2.0 upwards.
  1. 将此bundle添加到您的应用程序的kernel中

    // app/AppKernel.php public function registerBundles() { return array( // ... new RG\UserVoiceBundle\RGUserVoiceBundle(), // ... ); }

  2. 在您的config.yml中配置rg_user_voice服务

    rg_user_voice: domain: %uservoice_domain% sso_key: %uservoice_sso_key% widget_key: %uservoice_widget_key% primary_color: %uservoice_primary_color% link_color: %uservoice_link_color% forum_id: %uservoice_forum_id%

基本配置到此完成。

使用方法

在您的模板中,您可以使用小部件

{% include "UserVoiceBundle::widget.html.twig" %}

在您的控制器中

$userVoiceOptions = $this->container->get('rg_uservoice_options');
$userVoiceOptions["disabled"] = !$this->getUser()->getAccount()->isUserVoiceEnabled();

可用的UserVoice选项

- disabled: true (default: false)

您还可以从Twig模板生成您的SSO令牌

<a href="http://domain.uservoice.com/knowledgebase?sso={{ rg_uservoice_sso(app.user.name) }}">

覆盖模板

您可以通过复制bundle中的Resources/views/widget.html.twig文件并将其放置到app/Resources/RGUserVoiceBundle/views中,然后按需定制来覆盖模板。