PHP Class kartik\social\GithubXPlugin

Usage: echo GithubXPlugin::widget([ 'type' => GithubPlugin::WATCH, 'user' => 'GITHUB_USER', 'repo' => 'GITHUB_REPO', 'settings' => ['data-style'=>'mega'] ]);
See also: https://github.com/ntkme/github-buttons
Since: 1.0
Author: Kartik Visweswaran ([email protected])
Inheritance: extends Widget
Datei anzeigen Open project: kartik-v/yii2-social

Public Properties

Property Type Description
$label the button label to display. If not set it will be autogenerated based on the button type.
$options the HTML attributes for the button
$repo the Github repository name. This is mandatory for all buttons except FOLLOW.
$settings the social plugin settings. The following attributes are recognized: - href: GitHub link for the button. - data-style: controls the size of the button one of default or mega. - data-icon: string, the octicon for the button. It will be autogenerated if not set. All available icons can be found at Octicons. - data-count-href: GitHub link for the count. It defaults to href value (generated from repo and user name). Relative url will be relative to href value. It will be autogenerated if not set. - data-count-api: string, GitHub API endpoint for the count. It will be autogenerated if not set.
$showCount whether to show the count. Defaults to true.
$type the type of button. One of 'watch', 'fork', 'follow'. This is mandatory.
$user the Github user name that owns the repo. This is mandatory.

Protected Properties

Property Type Description
$validPlugins the valid plugins

Public Methods

Method Description
getDefaultSetting ( ) : array Gets the default button configurations settings
init ( ) Initialize the widget
renderButton ( ) : string Renders the button
run ( )

Method Details

getDefaultSetting() public method

Gets the default button configurations settings
public getDefaultSetting ( ) : array
return array

init() public method

Initialize the widget
public init ( )

renderButton() public method

Renders the button
public renderButton ( ) : string
return string

run() public method

public run ( )

Property Details

$label public_oe property

the button label to display. If not set it will be autogenerated based on the button type.
public $label

$options public_oe property

the HTML attributes for the button
public $options

$repo public_oe property

the Github repository name. This is mandatory for all buttons except FOLLOW.
public $repo

$settings public_oe property

the social plugin settings. The following attributes are recognized: - href: GitHub link for the button. - data-style: controls the size of the button one of default or mega. - data-icon: string, the octicon for the button. It will be autogenerated if not set. All available icons can be found at Octicons. - data-count-href: GitHub link for the count. It defaults to href value (generated from repo and user name). Relative url will be relative to href value. It will be autogenerated if not set. - data-count-api: string, GitHub API endpoint for the count. It will be autogenerated if not set.
public $settings

$showCount public_oe property

whether to show the count. Defaults to true.
public $showCount

$type public_oe property

the type of button. One of 'watch', 'fork', 'follow'. This is mandatory.
public $type

$user public_oe property

the Github user name that owns the repo. This is mandatory.
public $user

$validPlugins protected_oe property

the valid plugins
protected $validPlugins