ezsystems / share-buttons-bundle
社交分享按钮集成包,可集成到eZ Publish/eZ Platform
v1.2.0
2018-06-28 06:41 UTC
Requires
- symfony/symfony: ~2.6 || ^3.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ~2.7.1
This package is auto-updated.
Last update: 2024-09-18 23:49:58 UTC
README
此包将社交分享按钮添加到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分享
使用方法
在您想显示分享按钮栏的地方插入以下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许可证。