ItemAsset::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
namespace Phpsa\Datastore\Ams\Article;
3
use Phpsa\Datastore\Asset;
4
5
6
class ItemAsset extends Asset {
7
8
    public $name = 'Article';
9
    public $shortname = 'article';
10
    public $value_equals = 'title';
11
    public $status_equals = 'published';
12
13
14
    public $properties = array(
15
        'title' => array(
16
            'name' => 'Heading',
17
            'type' => self::STRING,
18
			'required' => true
19
        ),
20
        'intro' => array(
21
            'name' => 'Intro',
22
            'type' => self::TEXT
23
        ),
24
        'content' => array(
25
            'name' => 'Full Body',
26
            'type' => self::HTML
27
		),
28
		'author' => array(
29
			'name' => 'Author',
30
			'type' => self::IDENTITY
31
		),
32
        'published' => array(
33
            'name' => 'Published',
34
            'type' => self::DROPDOWN,
35
			'options' => ['draft' => 'Draft', 'published' => 'Published', 'aarchive' => 'Archived'],
36
			'published' => ['published']
37
        ),
38
39
    );
40
41
    public static function about() {
42
        return 'An Article Asset  which only holds a particular page\'s content. Can be assigned to one or more Article Categories';
43
    }
44
45
46
47
		/**
48
	 * generate the route for this asset
49
	 */
50
	public static function route($record, $path = null){
51
		$page = $record->page;
52
53
		return $path ? route('frontend.ams.articles.article', ['slug' => $page->slug, 'path' => $path]) : route('frontend.ams.article.article', ['slug' => $page->slug]);
54
	}
55
56
}
57