PHP Class yii\authclient\widgets\AuthChoice

It opens a popup window for the client authentication process. By default this widget relies on presence of Collection among application components to get auth clients information. Example: php ['site/auth'] ]); ?> You can customize the widget appearance by using [[begin()]] and [[end()]] syntax along with using method AuthChoice::clientLink or AuthChoice::createClientUrl. For example: php ['site/auth'] ]); ?>
    getClients() as $client): ?>
  • clientLink($client) ?>
This widget supports following keys for [[ClientInterface::getViewOptions()]] result: - popupWidth: int, width of the popup window in pixels. - popupHeight: int, height of the popup window in pixels. - widget: array, configuration for the widget, which should be used to render a client link; such widget should be a subclass of [[AuthChoiceItem]].
See also: yii\authclient\AuthAction
Since: 2.0
Author: Paul Klimov ([email protected])
Inheritance: extends yii\base\Widget
Mostrar archivo Open project: yiisoft/yii2-authclient Class Usage Examples

Public Properties

Property Type Description
$autoRender indicates if widget content, should be rendered automatically. Note: this value automatically set to 'false' at the first call of AuthChoice::createClientUrl
$clientCollection name of the auth client collection application component. This component will be used to fetch services value if it is not set.
$clientIdGetParamName name of the GET param , which should be used to passed auth client id to URL defined by [[baseAuthUrl]].
$clientOptions additional options to be passed to the underlying JS plugin.
$options the HTML attributes that should be rendered in the div HTML tag representing the container element.
$popupMode indicates if popup window should be used instead of direct links.

Public Methods

Method Description
clientLink ( yii\authclient\ClientInterface $client, string $text = null, array $htmlOptions = [] ) : string Outputs client auth link.
createClientUrl ( yii\authclient\ClientInterface $client ) : string Composes client auth URL.
getBaseAuthUrl ( ) : array
getClients ( ) : yii\authclient\ClientInterface[]
init ( ) Initializes the widget.
run ( ) : string Runs the widget.
setBaseAuthUrl ( array $baseAuthUrl )
setClients ( array $clients )

Protected Methods

Method Description
defaultBaseAuthUrl ( ) : array Composes default base auth URL configuration.
defaultClients ( ) : yii\authclient\ClientInterface[] Returns default auth clients list.
renderMainContent ( ) : string Renders the main content, which includes all external services links.

Method Details

createClientUrl() public method

Composes client auth URL.
public createClientUrl ( yii\authclient\ClientInterface $client ) : string
$client yii\authclient\ClientInterface external auth client instance.
return string auth URL.

defaultBaseAuthUrl() protected method

Composes default base auth URL configuration.
protected defaultBaseAuthUrl ( ) : array
return array base auth URL configuration.

defaultClients() protected method

Returns default auth clients list.
protected defaultClients ( ) : yii\authclient\ClientInterface[]
return yii\authclient\ClientInterface[] auth clients list.

getBaseAuthUrl() public method

public getBaseAuthUrl ( ) : array
return array base auth URL configuration.

getClients() public method

public getClients ( ) : yii\authclient\ClientInterface[]
return yii\authclient\ClientInterface[] auth providers

init() public method

Initializes the widget.
public init ( )

renderMainContent() protected method

Renders the main content, which includes all external services links.
protected renderMainContent ( ) : string
return string generated HTML.

run() public method

Runs the widget.
public run ( ) : string
return string rendered HTML.

setBaseAuthUrl() public method

public setBaseAuthUrl ( array $baseAuthUrl )
$baseAuthUrl array base auth URL configuration.

setClients() public method

public setClients ( array $clients )
$clients array auth providers

Property Details

$autoRender public_oe property

indicates if widget content, should be rendered automatically. Note: this value automatically set to 'false' at the first call of AuthChoice::createClientUrl
public $autoRender

$clientCollection public_oe property

name of the auth client collection application component. This component will be used to fetch services value if it is not set.
public $clientCollection

$clientIdGetParamName public_oe property

name of the GET param , which should be used to passed auth client id to URL defined by [[baseAuthUrl]].
public $clientIdGetParamName

$clientOptions public_oe property

additional options to be passed to the underlying JS plugin.
public $clientOptions

$options public_oe property

the HTML attributes that should be rendered in the div HTML tag representing the container element.
See also: yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
public $options

$popupMode public_oe property

indicates if popup window should be used instead of direct links.
public $popupMode