Completed
Push — master ( cd1ec1...578283 )
by Zack
243:03 queued 200:08
created

GravityView_Default_Template_Table   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 58
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 55 2
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 7 and the first side effect is on line 66.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
/**
4
 * GravityView_Default_Template_Table class.
5
 * Defines Table(default) template
6
 */
7
class GravityView_Default_Template_Table extends GravityView_Template {
8
9
	function __construct( $id = 'default_table', $settings = array(), $field_options = array(), $areas = array() ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
10
11
		/**
12
		 * @filter `gravityview/template/table/use-legacy-style` Should GravityView use the legacy Table layout stylesheet (from before Version 2.1)?
13
		 * @since 2.1.1
14
		 * @param bool $use_legacy_table_style If true, loads `table-view-legacy.css`. If false, loads `table-view.css`. Default: `false`
15
		 */
16
		$use_legacy_table_style = apply_filters( 'gravityview/template/table/use-legacy-style', false );
17
18
		$css_filename = 'table-view.css';
19
20
		if ( $use_legacy_table_style ) {
21
			$css_filename = 'table-view-legacy.css';
22
		}
23
24
		$table_settings = array(
25
			'slug'        => 'table',
26
			'type'        => 'custom',
27
			'label'       => __( 'Table (default)', 'gravityview' ),
28
			'description' => __( 'Display items in a table view.', 'gravityview' ),
29
			'logo'        => plugins_url( 'includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE ),
30
			'css_source'  => gravityview_css_url( $css_filename, GRAVITYVIEW_DIR . 'templates/css/' ),
31
		);
32
33
		$settings = wp_parse_args( $settings, $table_settings );
34
35
		/**
36
		 * @see  GravityView_Admin_Views::get_default_field_options() for Generic Field Options
37
		 * @var array
38
		 */
39
		$field_options = array(
40
			'show_as_link' => array(
41
				'type'    => 'checkbox',
42
				'label'   => __( 'Link to single entry', 'gravityview' ),
43
				'value'   => false,
44
				'context' => 'directory'
0 ignored issues
show
introduced by
Each line in an array declaration must end in a comma
Loading history...
45
			),
46
		);
47
48
		$areas = array(
49
			array(
50
				'1-1' => array(
51
					array(
52
						'areaid'   => 'table-columns',
53
						'title'    => __( 'Visible Table Columns', 'gravityview' ),
54
						'subtitle' => __( 'Each field will be displayed as a column in the table.', 'gravityview' ),
55
					)
0 ignored issues
show
introduced by
Comma required after last value in array declaration
Loading history...
56
				)
57
			)
0 ignored issues
show
introduced by
Comma required after last value in array declaration
Loading history...
58
		);
59
0 ignored issues
show
Coding Style introduced by
Functions must not contain multiple empty lines in a row; found 2 empty lines
Loading history...
60
61
		parent::__construct( $id, $settings, $field_options, $areas );
62
63
	}
64
}
65
66
new GravityView_Default_Template_Table;