Blame view

frontend/views/comment/artbox_comment_reply.php 2.07 KB
518c4e3f   Alexey Boroda   -Article with com...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
  <?php
      use artbox\webcomment\models\CommentModel;
      use yii\base\Model;
      use yii\helpers\Html;
      use yii\helpers\Url;
      use yii\web\View;
      use yii\widgets\ActiveForm;
      
      /**
       * @var CommentModel $comment_model
       * @var array        $form_params
       * @var Model        $model
       * @var string       $formId
       * @var View         $this
       */
      $text_input_id = Html::getInputId($comment_model, 'text') . '-reply';
      $parent_id_input_id = Html::getInputId($comment_model, 'parent_id') . '-reply';
      $text_input_selectors = [
          'container' => '.field-' . $text_input_id,
          'input'     => '#' . $text_input_id,
      ];
      $parent_id_input_selectors = [
          'container' => '.field-' . $parent_id_input_id,
          'input'     => '#' . $parent_id_input_id,
      ];
      $form = ActiveForm::begin([
          'id'     => $formId . '-reply',
          'action' => Url::to([
              'artbox-comment/default/create',
              'entity' => $comment_model->encryptedEntity,
          ]),
      ]);
  ?>
      <div class="answer-form">
          <?php
              echo $form->field(
                  $comment_model,
                  'parent_id',
                  [
                      'selectors' => $parent_id_input_selectors,
                  'inputOptions' => [
                      'id'    => $parent_id_input_id,
                      'class' => 'form-control',
                  ],
              ])
                        ->hiddenInput()
                        ->label(false);
              echo $form->field($comment_model, 'text', [
                  'selectors'    => $text_input_selectors,
                  'inputOptions' => [
                      'id'    => $text_input_id,
                      'class' => 'form-control',
                      'cols'  => 30,
                      'rows'  => 10,
                  ],
              ])
                        ->textarea();
              echo Html::submitButton(Yii::t('artbox-comment', 'Submit'));
              echo Html::button(Yii::t('artbox-comment', 'Cancel'), [ 'data-action' => 'reply-cancel' ]);
          ?>
      </div>
  <?php
      ActiveForm::end();
  ?>