CategoryAsset::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\Article;
4
use Phpsa\Datastore\Asset;
5
use Phpsa\Datastore\Ams\Article\ItemAsset;
6
class CategoryAsset extends Asset {
7
8
	public $name = 'Article Category';
9
	public $shortname = 'ArticleCategory';
10
	/* assets that can be children, a value means it is limited to that many children, -1 means unlimited  */
11
	public $accept = ItemAsset::class;
12
	public $accept_limit = "-1";
13
14
	// map our value as equal to whatever the title property is set on save.
15
	public $value_equals = 'category';
16
17
18
	public $properties = array(
19
		'category' => array(
20
			'name' => 'Category',
21
			'type' => self::STRING,
22
			'required' => true
23
		),
24
		'status' => array(
25
            'name' => 'Published',
26
            'type' => self::DROPDOWN,
27
			 'options' => ['published' => 'Published', 'unpublished' => 'Unpublished'],
28
			 'published' => ['published']
29
        ),
30
31
	);
32
33
	public static function about() {
34
		return 'This is a category to which Article Items are assigned. <br/>
35
			Assigning Article Items to such a category makes them easier to manage and maintain, and also
36
			makes it easier for your audience to find them.';
37
	}
38
39
40
	/**
41
	 * generate the route for this asset
42
	 */
43
	public static function route($record, $path = null){
44
		$page = $record->page;
45
		return route('frontend.ams.article.category', ['slug' => $page->slug]);
46
	}
47
}
48