documentation update + code fixes

This commit is contained in:
Antonio Ramirez
2017-06-11 23:25:51 +02:00
parent 4dedf111a1
commit 7344ad31df
91 changed files with 1699 additions and 827 deletions

View File

@ -42,7 +42,7 @@ class AssignmentsWidget extends Widget
{
parent::init();
if ($this->userId === null) {
throw new InvalidConfigException(__CLASS__.'::$userId is required');
throw new InvalidConfigException(__CLASS__ . '::$userId is required');
}
}
@ -57,10 +57,13 @@ class AssignmentsWidget extends Widget
$this->make(UpdateAuthAssignmentsService::class, [$model])->run();
}
return $this->render('/widgets/assignments/form', [
'model' => $model,
'availableItems' => $this->getAvailableItems(),
]);
return $this->render(
'/widgets/assignments/form',
[
'model' => $model,
'availableItems' => $this->getAvailableItems(),
]
);
}
/**
@ -70,10 +73,14 @@ class AssignmentsWidget extends Widget
*/
protected function getAvailableItems()
{
return ArrayHelper::map($this->getAuthManager()->getItems(), 'name', function ($item) {
return empty($item->description)
? $item->name
: $item->name.' ('.$item->description.')';
});
return ArrayHelper::map(
$this->getAuthManager()->getItems(),
'name',
function ($item) {
return empty($item->description)
? $item->name
: $item->name . ' (' . $item->description . ')';
}
);
}
}

View File

@ -32,7 +32,7 @@ class ConnectWidget extends AuthChoice
{
AuthChoiceAsset::register(Yii::$app->view);
if ($this->popupMode) {
Yii::$app->view->registerJs("\$('#".$this->getId()."').authchoice();");
Yii::$app->view->registerJs("\$('#" . $this->getId() . "').authchoice();");
}
$this->options['id'] = $this->getId();
echo Html::beginTag('div', $this->options);
@ -45,9 +45,9 @@ class ConnectWidget extends AuthChoice
{
if ($this->isConnected($provider)) {
return Url::to(['/user/settings/disconnect', 'id' => $this->accounts[$provider->getId()]->id]);
} else {
return parent::createClientUrl($provider);
}
return parent::createClientUrl($provider);
}
/**