此包已被弃用且不再维护。未建议替代包。

Pinterest 小部件的 Yii2 扩展

安装: 59

依赖: 0

建议: 0

安全: 0

星标: 2

关注者: 1

分支: 0

开放问题: 0

类型:yii2-extension

dev-master / 1.0.x-dev 2016-08-12 21:11 UTC

This package is not auto-updated.

Last update: 2021-11-27 11:13:19 UTC


README

Yii2 扩展用于 Pinterest 小部件,使得在您的网站上添加 Pinterest 内容变得容易。

资源

安装

Composer

将扩展添加到您的 composer.json 并像通常那样更新依赖项,例如通过运行 composer update

{
    "require": {
        "nirvana-msu/yii2-pinterest-widgets": "1.0.*@dev"
    }
}

可用的完整小部件列表如下

  • Pin It 按钮
  • Pinterest 关注按钮
  • Pinterest Pin 小部件
  • Pinterest 个人资料小部件
  • Pinterest 板小部件

Pin It 按钮

Pin It 按钮是您业务将内容添加到 Pinterest 的最佳方式。只需单击一下,访客就可以将他们喜欢的网站内容保存到 Pinterest,这有助于更多 Pinners 发现您。

prop type default notes
type string 'any' 枚举 ['any', 'one']
large boolean 未设置 (false) 是否为大尺寸按钮
round boolean 未设置 (false) 是否为圆形按钮

以下 props 仅适用于 type="one"。每个 prop 都指向点击时要固定的 Pin。将使用 mediaurldescription 创建新的 Pin。

prop type notes
media string 要创建的 Pin 的图片 URL
url string 要创建的 Pin 的链接回
description string 要创建的 Pin 的描述

注意:此小部件当前支持比这更多的设置。有关设置、默认值及其影响的完整说明,请参阅 文档

使用

// To create a Pin one Pin It button
echo PinItButton::widget([
    'type' => 'one',
    'media' => 'https://goo.gl/zFFBUK',
    'url' => 'https://goo.gl/hQmcWP',
    'description' => 'Example Stuff',
]);

// To Create a Pin any Pin It Button: opens the image picker overlay
echo PinItButton::widget(['type' => 'any']);
echo PinItButton::widget(['type' => 'any', 'large' => true]);
echo PinItButton::widget(['type' => 'any', 'round' => true]);
echo PinItButton::widget(['type' => 'any', 'round' => true, 'large' => true]);

Pinterest 关注按钮

关注按钮让 Pinners 可以轻松关注您的 Pinterest 页面。

prop type notes
board string 要关注的板的 slug (code><username>/<board_name>)
user string 要关注的用户的用户名
text string 关注按钮上显示的文本

选择一个 boarduser 来关注。如果两者都指定,则使用 board

使用

// To create a board follow button
echo PinterestFollowButton::widget([
    'board' => 'pinterest/official-news',
    'text' => 'Official News',
]);

// To create a profile follow button
echo PinterestFollowButton::widget([
    'user' => 'pinterest',
    'text' => 'Pinterest',
]);

Pinterest Pin 小部件

Pin 小部件允许您显示一个 Pin,非常适合您找到与您的外观和感觉相匹配的 Pin。

prop type default notes
pin string 必需的 要显示的 Pin 的 id
size string 未设置 ('small') 枚举值:['小', '中', '大']
简洁的 boolean 未设置 (false) 是否隐藏描述

使用

// Pin Widgets default to small
echo PinterestPin::widget(['pin' => '530158187357124374']);
echo PinterestPin::widget(['pin' => '530158187357124374', 'size' => 'medium']);
echo PinterestPin::widget(['pin' => '530158187357124374', 'size' => 'large', 'terse' => true]);

Pinterest 板块小工具

板块小工具显示整个板块(最多50个Pin),让您访问者快速了解您的Pinterest个人资料。

prop type default notes
board string 必需的 板块的缩略名(格式:<用户名>/<板块名称>)
boardWidth 数字类型 未设置 板块小工具的宽度
boardHeight 数字类型 未设置 板块小工具的高度
imageWidth 数字类型 未设置 小工具内Pin缩略图的宽度

使用

echo PinterestBoard::widget([
    'board' => 'pinterest/official-news',
    'boardWidth' => 400,
    'boardHeight' => 320,
    'imageWidth' => 80,
]);

Pinterest 个人资料小工具

个人资料小工具显示您最近保存的Pin。

prop type default notes
user string 必需的 个人资料的昵称
boardWidth 数字类型 未设置 板块小工具的宽度
boardHeight 数字类型 未设置 板块小工具的高度
imageWidth 数字类型 未设置 小工具内Pin缩略图的宽度

使用

echo PinterestProfile::widget([
    'user' => 'pinterest',
    'boardWidth' => 400,
    'boardHeight' => 320,
    'imageWidth' => 80,
]);

##许可证

此扩展程序在MIT许可证下发布。