New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contact force verification #2
Conversation
bladeroot
commented
Jan 6, 2017
- ForceVerificationBlock widget
- use ForceVerificationBlock in Contact and Client View
<?php $box->end() ?> | ||
<?php endif ?> | ||
<?= ForceVerificationBlock::widget([ | ||
'model' => $model, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
у тебя тут отступ 8 пробелов - а у нас везде 4
проверь свои настройки что было 4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
правильно. виджет находится между дивами. таб = 4 пробела
@@ -48,6 +50,10 @@ | |||
<?= ClientDetailMenu::widget(['model' => $model]) ?> | |||
</div> | |||
<?php Box::end() ?> | |||
|
|||
<?= ForceVerificationBlock::widget([ | |||
'model' => $model->contact |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
закидывай запятую в массивах, потом легче докидывать новые элементы
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
По-моему всё зашибись!
Ещё Дима глянет и замержит.
<?= Verification::widget([ | ||
'model' => $model->getVerification($attribute), | ||
'scenario' => $scenario, | ||
'submitUrl' => $submitUrl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут тоже не хватает запятой
use yii\helpers\Html; | ||
use hipanel\widgets\Box; | ||
use hipanel\modules\client\widgets\Verification; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В блоке PHPDoc мы описываем переменные, которые приходят извне.
Смотри пример тут https://github.com/hiqdev/hipanel-module-mailing/blob/master/src/views/prepare/index.php#L6-L14
|
||
if ($this->title === null) { | ||
$this->title = Yii::t('hipanel:client', 'Verification level'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лишняя строка
* | ||
* @var array | ||
*/ | ||
public $options = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
кажется, это свойство не используется
'scenario' => $this->scenario, | ||
'submitUrl' => $this->submitUrl | ||
]); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Методы должны иметь явно описанные возвращаемые данные. Предпочтительно использование условий для прерывания выполнения, вместо описания полезного кода внутри if. Это упрощает чтение кода.
if (!Yii::$app->user->can('contact.force-verify')) {
return;
}
return $this->render((new \ReflectionClass($this))->getShortName(), [
'attributes' => $this->attributes,
'model' => $this->model,
'title' => $this->title,
'scenario' => $this->scenario,
'submitUrl' => $this->submitUrl
]);
}