ContentAsset::about()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
2
3
namespace Phpsa\Datastore\Ams;
4
use Phpsa\Datastore\Asset;
5
6
class ContentAsset extends Asset {
7
8
	public $name = 'Basic Content';
9
	public $shortname = 'Content';
10
	public $is_child = false;
11
12
	public $value_equals = 'title';
13
    public $status_equals = 'status';
14
15
	public $properties = array(
16
		'title' => array(
17
			'name' => 'Title',
18
			'type' => self::STRING,
19
			'help' => 'Title of your article',
20
			'required' => true,
21
			'validation_messages' => 'A Title Is required'
22
		),
23
		'content' => array(
24
			'name' => 'Content',
25
			'type' => self::HTML
26
		),
27
		'status' => array(
28
            'name' => 'Published',
29
            'type' => self::DROPDOWN,
30
			'options' => ['published' => 'Published', 'unpublished' => 'Unpublished'],
31
			'published' => ['published']
32
        ),
33
	);
34
35
	public static function about() {
36
		return 'A basic content asset, allows for a title and some html content';
37
	}
38
39
			/**
40
	 * generate the route for this asset
41
	 */
42
	public static function route($record, $path = null){
43
		$path = 'frontend.ams.page.slug';
44
		$page = $record->page;
45
		return route($path, ['slug' => $page->slug]);
46
	}
47
48
49
}
50