diff --git a/views/artbox_comment_item.php b/views/artbox_comment_item.php
index 3b397dc..678ea69 100755
--- a/views/artbox_comment_item.php
+++ b/views/artbox_comment_item.php
@@ -9,6 +9,7 @@
* @var mixed $key
* @var int $index
* @var ListView $widget
+ * @var string $display_name
*/
?>
customer)) {
- echo $model->customer->username;
+ echo $model->customer->$nameField;
} else {
echo $model->username . ' (' . Yii::t('artbox-comment', 'Guest') . ')';
}
diff --git a/views/artbox_comment_list.php b/views/artbox_comment_list.php
index c13d208..8c9d2ef 100755
--- a/views/artbox_comment_list.php
+++ b/views/artbox_comment_list.php
@@ -15,6 +15,7 @@
* @var Model $model
* @var ActiveDataProvider $comments
* @var View $this
+ * @var srring $display_name
*/
Pjax::begin();
if(( $success = \Yii::$app->session->getFlash('artbox_comment_success') ) != NULL) {
@@ -25,6 +26,10 @@
'itemOptions' => $item_options,
'itemView' => $item_view,
'summary' => '',
+ 'viewParams' => [
+ 'display_name' => $display_name
+ ]
+
]);
Pjax::end();
\ No newline at end of file
diff --git a/widgets/CommentWidget.php b/widgets/CommentWidget.php
index 65500c4..cca2adf 100755
--- a/widgets/CommentWidget.php
+++ b/widgets/CommentWidget.php
@@ -24,6 +24,10 @@
*/
class CommentWidget extends Widget
{
+ /**
+ * @var string what field is displayed in the user name
+ */
+ public $display_name = 'username';
/**
* Model, to which comment attached
@@ -400,6 +404,8 @@
'comments' => $comments,
'item_options' => $this->itemOptions,
'item_view' => $this->itemView,
+ 'display_name' => $this->display_name,
+
]
),
$list_options
--
libgit2 0.21.4