|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @package Cadmium\System\Modules\Entitizer |
|
5
|
|
|
* @author Anton Romanov |
|
6
|
|
|
* @copyright Copyright (c) 2015-2017, Anton Romanov |
|
7
|
|
|
* @link http://cadmium-cms.com |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
namespace Modules\Entitizer\Form { |
|
11
|
|
|
|
|
12
|
|
|
use Modules\Entitizer, Utils\Form, Utils\Range; |
|
13
|
|
|
|
|
14
|
|
|
class Page extends Form { |
|
15
|
|
|
|
|
16
|
|
|
protected $name = 'page'; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Constructor |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
public function __construct(Entitizer\Entity\Page $page) { |
|
23
|
|
|
|
|
24
|
|
|
$this->addText('title', $page->title, FORM_FIELD_TEXT, CONFIG_PAGE_TITLE_MAX_LENGTH, ['required' => true]); |
|
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
$this->addText('name', $page->name, FORM_FIELD_TEXT, CONFIG_PAGE_NAME_MAX_LENGTH, ['required' => true, 'convert' => 'url']); |
|
|
|
|
|
|
27
|
|
|
|
|
28
|
|
|
$this->addSelect('visibility', $page->visibility, Range\Visibility::getRange()); |
|
|
|
|
|
|
29
|
|
|
|
|
30
|
|
|
$this->addSelect('access', $page->access, Range\Access::getRange()); |
|
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
$this->addText('description', $page->description, FORM_FIELD_TEXTAREA, CONFIG_PAGE_DESCRIPTION_MAX_LENGTH); |
|
|
|
|
|
|
33
|
|
|
|
|
34
|
|
|
$this->addText('keywords', $page->keywords, FORM_FIELD_TEXTAREA, CONFIG_PAGE_KEYWORDS_MAX_LENGTH); |
|
|
|
|
|
|
35
|
|
|
|
|
36
|
|
|
$this->addCheckbox('robots_index', ((0 !== $page->id) ? $page->robots_index : true)); |
|
|
|
|
|
|
37
|
|
|
|
|
38
|
|
|
$this->addCheckbox('robots_follow', ((0 !== $page->id) ? $page->robots_follow : true)); |
|
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
$this->addText('contents', $page->contents, FORM_FIELD_TEXTAREA, 0, ['multiline' => true, 'codestyle' => true]); |
|
|
|
|
|
|
41
|
|
|
} |
|
42
|
|
|
} |
|
43
|
|
|
} |
|
44
|
|
|
|
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.