BlockAsset   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 28
c 1
b 0
f 0
dl 0
loc 47
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A about() 0 2 1
A route() 0 5 1
1
<?php
2
3
namespace Phpsa\Datastore\Ams;
4
use Phpsa\Datastore\Asset;
5
use Phpsa\Datastore\Ams\SubHeadingAsset;
6
7
class BlockAsset extends Asset {
8
9
	public $name = 'Block Content';
10
	public $shortname = 'Block';
11
	public $is_child = false;
12
13
	public $page_js = 'off';
14
	public $page_css = 'on';
15
16
	public $private = true;
17
18
	public $value_equals = 'title';
19
20
	public $properties = array(
21
		'title' => array(
22
			'name' => 'Title',
23
			'type' => self::STRING,
24
			'help' => 'Title of your block',
25
			'required' => true,
26
			'validation_messages' => 'A Title Is required'
27
		),
28
		'heading' => [
29
			'name' => 'Heading',
30
			'type' => self::HEADING
31
		],
32
		'subheader' => [
33
			'name' => 'SubHeading',
34
			'type' => SubHeadingAsset::class
35
		],
36
		'content' => array(
37
			'name' => 'Content',
38
			'type' => self::HTML
39
		)
40
	);
41
42
	public static function about() {
43
		return 'A basic Block content asset, allows for injecting editable zones';
44
	}
45
46
			/**
47
	 * generate the route for this asset
48
	 */
49
	public static function route($record, $path = null){
50
51
		$path = 'frontend.ams.page.slug';
52
		$page = $record->page;
53
		return route($path, ['slug' => $page->slug]);
54
	}
55
56
57
}
58