ezsystems/share-buttons-bundle

社交分享按钮集成包,可集成到eZ Publish/eZ Platform

安装次数: 24,496

依赖者: 1

建议者: 0

安全性: 0

星标: 5

关注者: 26

分支: 10

类型:symfony-bundle

v1.2.0 2018-06-28 06:41 UTC

This package is auto-updated.

Last update: 2024-09-18 23:49:58 UTC


README

SensioLabsInsight

此包将社交分享按钮添加到Symfony应用程序中(包括eZ Publish 5.x & eZ Platform)。

需求

  • Symfony v2.6或更高版本。

安装

此包可通过Composer获得,所以下面的说明与其他开源Symfony Bundle的安装方式相似。

在终端中运行以下命令,从您的Symfony安装根目录(选择最新版本)

php composer.phar require ezsystems/share-buttons-bundle

app/AppKernel.php文件(对于常规Symfony应用程序)或ezpublish\EzPublishKernel.php文件(对于eZ Publish / eZ Platform)中启用该包

$bundles = array(
    // existing bundles
    new EzSystems\ShareButtonsBundle\EzSystemsShareButtonsBundle()
);

安装默认模板的附加资源(CSS)(如果您计划使用自定义样式表,则跳过此步骤)

{% stylesheets
    bundles/ezsystemssharebuttonsbundle/css/default.css
%}
    <link rel="stylesheet" type="text/css" href="{{ asset_url }}"/>
{% endstylesheets %}

配置

包的配置依赖于siteaccess。这是一个配置示例(config.yml

ez_share_buttons:
    system:
        default:
            # enable only those providers you are interested
            providers:
                - facebook_like
                - facebook_recommend
                - twitter
                - linkedin
                - google_plus
                - xing
            template: default
            
            facebook_like:
                # available options are: standard, box_count, button_count, button
                layout: button
                width: ~
                show_faces: true
                # displays additional `share` button
                share: false
            
            facebook_recommend:
                # available options are: standard, box_count, button_count, button
                layout: button
                width: ~
                show_faces: true
                # displays additional `share` button
                share: false

            twitter:
                show_username: false
                large_button: false
                language: ~

            linkedin:
                # available options are: top, right, none
                count_mode: none
                language: en_US

            google_plus:
                # available options are: small, medium, standard, tall
                size: medium
                # available options are: inline, bubble, none
                annotation: none
                width: ~
                language: en-GB

            xing:
                # available options are: square, none
                shape: none
                # available options are: right, top, none
                counter: none
                # available options are: de, none
                language: none

功能

评论抽象

ShareButtonsBundle基于提供者的。这意味着它对任何类型的社交分享服务都开放。

单个入口点

使用一行代码渲染您的社交分享按钮。

可用集成

目前,ShareButtonsBundle正在与以下社交分享服务协作

  • Facebook点赞
  • Facebook推荐
  • Google Plus
  • LinkedIn分享
  • Twitter
  • Xing

使用方法

在您想显示分享按钮栏的地方插入以下Twig辅助函数

{{ show_share_buttons() }}

您可以通过添加额外参数来覆盖现有的ShareButtonsBundle siteaccess配置

{{ show_share_buttons(
   options = {
       provider_label: {
           key: 'value'
       },
       template: 'default'
   },
   providers = ['provider_label']
) }}

使用方法的更多实际示例

{{ show_share_buttons(
    options = {
        facebook_like: {
            layout: 'button_count',
            show_faces: true
        },
        google_plus: {
            size: 'small',
            annotation: 'bubble'
        }
        template: 'default'
    },
    providers = ['facebook_like', 'google_plus']
 ) }}  

许可证

此包受GPL v2.0许可证