1 | <?php |
||
2 | |||
3 | use Apps\ActiveRecord\ProfileField; |
||
4 | use Ffcms\Templex\Url\Url; |
||
0 ignored issues
–
show
|
|||
5 | |||
6 | /** @var Apps\Model\Front\Profile\FormSettings $model */ |
||
7 | /** @var \Ffcms\Templex\Template\Template $this */ |
||
8 | |||
9 | $this->layout('_layouts/default', [ |
||
10 | 'title' => __('Profile settings'), |
||
11 | 'breadcrumbs' => [ |
||
12 | Url::to('main/index') => __('Home'), |
||
13 | Url::to('profile/show', [\App::$User->identity()->getId()]) => __('Profile'), |
||
14 | __('Settings') |
||
15 | ] |
||
16 | ]); |
||
17 | ?> |
||
18 | |||
19 | <?php $this->start('body') ?> |
||
20 | |||
21 | <?php $this->insert('profile/menus/settings') ?> |
||
22 | |||
23 | <h1><?= __('Profile settings') ?></h1> |
||
24 | <hr /> |
||
25 | |||
26 | <?php $form = $this->form($model); ?> |
||
27 | <?= $form->start() ?> |
||
28 | |||
29 | <?= $form->fieldset()->text('nick', null, __('Enter your nickname or real name')) ?> |
||
30 | <?= $form->fieldset()->select('sex', ['options' => ['0' => __('Unknown'), '1' => __('Male'), '2' => __('Female')], 'optionsKey' => true], __('Choose your gender')) ?> |
||
31 | <?= $form->fieldset()->text('birthday', null, __('Enter your birthday date in d.m.Y format')) ?> |
||
32 | <?= $form->fieldset()->text('city', null, __('Enter the name of the city where you live')) ?> |
||
33 | <?= $form->fieldset()->text('hobby', null, __('Enter your hobbies in comma-separated format')) ?> |
||
34 | <?= $form->fieldset()->text('phone', null, __('Enter your phone number without spaces, if you want to make it public for other users')) ?> |
||
35 | <?= $form->fieldset()->text('url', null, __('If you have your own homepage - enter url there')) ?> |
||
36 | |||
37 | <?php |
||
38 | foreach (ProfileField::all() as $custom) { |
||
39 | echo $form->fieldset()->text('custom_data.' . $custom->id); |
||
40 | } |
||
41 | ?> |
||
42 | |||
43 | <?= $form->button()->submit(__('Save'), ['class' => 'btn btn-primary']) ?> |
||
44 | |||
45 | <?= $form->stop() ?> |
||
46 | |||
47 | <?php $this->stop() ?> |
||
48 |
Let?s assume that you have a directory layout like this:
and let?s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: