1 | <?php |
||
2 | |||
3 | use yii\helpers\{Html, Url}; |
||
4 | use yii\widgets\DetailView; |
||
5 | |||
6 | /* @var $this yii\web\View */ |
||
7 | /* @var $model app\models\Social */ |
||
8 | |||
9 | $this->title = $model->url; |
||
10 | $this->params['breadcrumbs'][] = [ |
||
11 | 'label' => Yii::t('social', 'Social'), |
||
12 | 'url' => [ |
||
13 | $this->params['urlPrefix'].'index' |
||
14 | ] |
||
15 | ]; |
||
16 | $this->params['breadcrumbs'][] = $this->title; |
||
17 | ?> |
||
18 | |||
19 | <style> |
||
20 | h5 { |
||
21 | font-weight: bold; |
||
22 | padding: 5px; |
||
23 | } |
||
24 | </style> |
||
25 | |||
26 | <div class="social-view"> |
||
27 | |||
28 | <p> |
||
29 | <?php echo Html::a(Yii::t('app', 'Update'), [ |
||
30 | $this->params['urlPrefix'].'update', |
||
31 | 'id' => $model->id |
||
32 | ], [ |
||
33 | 'class' => 'btn btn-primary' |
||
34 | ]) ?> |
||
35 | |||
36 | <?php echo Html::a(Yii::t('app', 'Delete'), [ |
||
37 | $this->params['urlPrefix'].'delete', |
||
38 | 'id' => $model->id |
||
39 | ], [ |
||
40 | 'class' => 'btn btn-danger', |
||
41 | 'data'=>[ |
||
42 | 'method' => 'post', |
||
43 | 'confirm' => Yii::t('app', 'Are you sure you want to do this action?'), |
||
44 | ] |
||
45 | ]) ?> |
||
46 | </p> |
||
47 | |||
48 | <?php echo DetailView::widget([ |
||
49 | 'model' => $model, |
||
50 | 'attributes' => [ |
||
51 | 'id', |
||
52 | [ |
||
53 | 'label' => Yii::t('app', 'Icon'), |
||
54 | 'value' => function ($model) { |
||
55 | /* @var $model app\models\Social */ |
||
56 | return Html::tag('i', '', ['class' => $model->icon]); |
||
57 | }, |
||
58 | 'format' => 'raw', |
||
59 | ], |
||
60 | [ |
||
61 | 'label' => Yii::t('social', 'Url'), |
||
62 | 'value' => function ($model) { |
||
63 | /* @var $model app\models\Social */ |
||
64 | return Html::a( |
||
65 | Html::encode($model->url), |
||
66 | Url::to($model->url), |
||
67 | [ |
||
68 | 'target' => '_blank' |
||
69 | ] |
||
70 | ); |
||
71 | }, |
||
72 | 'format' => 'raw', |
||
73 | ], |
||
74 | [ |
||
75 | 'label' => Yii::t('social', 'Parent contact records'), |
||
76 | 'value' => function ($model) { |
||
77 | /* @var $model app\models\Social */ |
||
78 | $contactRecords = ''; |
||
79 | foreach ($model->contacts as $contactRecord) { |
||
80 | $contactRecords .= Html::tag('li', |
||
81 | Html::a($contactRecord->getDefaultTranslate('title'), |
||
82 | Url::to(['/'.$this->params['shortLanguage'].'/admin/contacts/view', 'id' => $contactRecord->id]), |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
![]() |
|||
83 | [ |
||
84 | 'target' => '_blank' |
||
85 | ] |
||
86 | ) |
||
87 | ); |
||
88 | } |
||
89 | |||
90 | return empty($contactRecords) ? '' : Html::tag('ul', $contactRecords, [ |
||
91 | 'style' => 'margin-left: 10px; padding-left: 10px;' |
||
92 | ]); |
||
93 | }, |
||
94 | 'format' => 'raw', |
||
95 | ], |
||
96 | [ |
||
97 | 'attribute' => 'created_at', |
||
98 | 'format' => ['date', 'dd.MM.Y HH:mm:ss'], |
||
99 | 'label' => Yii::t('app', 'Created date'), |
||
100 | ], |
||
101 | [ |
||
102 | 'attribute' => 'updated_at', |
||
103 | 'format' => ['date', 'dd.MM.Y HH:mm:ss'], |
||
104 | 'label' => Yii::t('app', 'Updated date'), |
||
105 | ], |
||
106 | ], |
||
107 | ]) ?> |
||
108 | |||
109 | </div> |
||
110 |