Layout::get_taxonomies_layout()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace WPDFI;
4
5
/**
6
 * This class handle all actions related with layout for this plugin
7
 *
8
 * @author Duc Bui Quang <[email protected]>
9
 * @since 1.0.0
10
 */
11
12
use WPDFI\Traits\Singleton;
13
14
final class Layout {
15
16
	use Singleton;
17
18
	/**
19
	 * @traitDoc
20
	 */
21
	public function initializes() 
22
	{
23
		//
24
	}
25
26
	/**
27
	 * Get admin layout
28
	 *
29
	 * @param array $tabs
30
	 * @param string $current_tab
31
	 * @param mixed $options
32
	 * @param string $layout_name
33
	 * @since 1.0.0
34
	 * @return \VA\Templater
35
	 */
36
	public function get_admin_layout($tabs, $current_tab, $options, $layout_name) {
37
		return \wpdfi()->templater->render('admin.layout',[
38
			'tabs' => $tabs, 'current_tab' => $current_tab,
39
			'options' => $options, 'layout_name' => $layout_name,
40
		]); 
41
	}
42
43
	/**
44
	 * Get taxonomies layout
45
	 *
46
	 * @param array $taxonomies
47
	 * @since 1.0.0
48
	 * @return \VA\Templater
49
	 */
50
	public function get_taxonomies_layout($taxonomies) {
51
		return \wpdfi()->templater->render('admin.blocks.taxonomy.default', ['taxonomies' => $taxonomies]);
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
52
	}
53
54
	/**
55
	 * Get default layout of single dfi in admin
56
	 *
57
	 * @param integer $dfi_index
58
	 * @param boolean $include_delete
59
	 * @since 1.0.0
60
	 * @return VA\Templater
61
	 */
62
	public function get_default_layout($dfi_index, $include_delete) {
63
		return \wpdfi()->templater->render('admin.blocks.tabs.dfis.default', [
64
			'dfi_index' => $dfi_index, 'include_delete' => $include_delete
65
		]);
66
	}
67
68
	/**
69
	 * Get related layout with post type value, related layout include taxonomies, image upload and image size
70
	 *
71
	 * @param string $post_type
72
	 * @param integer $dfi_index
73
	 * @since 1.0.0
74
	 * @return string $layout
75
	 */
76
	public function get_related_layout($dfi_index, $post_type) {
77
		$layout = '';
78
		/* Get taxonomy layout */
79
		$layout.= \wpdfi()->templater->render('admin.blocks.taxonomy.default', [
0 ignored issues
show
introduced by
Expected 1 space before ".="; 0 found
Loading history...
80
			'taxonomies' => \wpdfi()->taxonomy->get($post_type),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
81
			'dfi_index' => $dfi_index
82
		]);
83
		$layout.= \wpdfi()->templater->render('admin.blocks.imageupload.default', [
0 ignored issues
show
introduced by
Expected 1 space before ".="; 0 found
Loading history...
84
			'dfi_index' => $dfi_index
85
		]);
86
		// $layout.= \wpdfi()->templater->render('admin.blocks.imagesize.default', [
87
		// 	'sizes' => \wpdfi()->image->get_size_names_and_dimensions()
88
		// ]);
89
		return $layout;
90
	}
91
}