1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace EventEspresso\core\domain\entities\editor\blocks; |
4
|
|
|
|
5
|
|
|
use EventEspresso\core\domain\entities\editor\EditorBlock; |
6
|
|
|
use WP_Block_Type; |
7
|
|
|
|
8
|
|
|
defined('EVENT_ESPRESSO_VERSION') || exit; |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Class Venue |
14
|
|
|
* Description |
15
|
|
|
* |
16
|
|
|
* @package EventEspresso\core\domain\entities\editor\blocks |
17
|
|
|
* @author Brent Christensen |
18
|
|
|
* @since $VID:$ |
19
|
|
|
*/ |
20
|
|
View Code Duplication |
class Venue extends EditorBlock |
21
|
|
|
{ |
22
|
|
|
|
23
|
|
|
const EDITOR_BLOCK_TYPE = 'ee-event-editor/venue-container'; |
24
|
|
|
|
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Perform any early setup required by the block |
28
|
|
|
* including setting the block type and supported post types |
29
|
|
|
* |
30
|
|
|
* @return void |
31
|
|
|
*/ |
32
|
|
|
public function initialize() |
33
|
|
|
{ |
34
|
|
|
$this->setEditorBlockType(Venue::EDITOR_BLOCK_TYPE); |
35
|
|
|
$this->setSupportedPostTypes(array('espresso_events', 'post', 'page')); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Registers the Editor Block with WP core; |
41
|
|
|
* Returns the registered block type on success, or false on failure. |
42
|
|
|
* |
43
|
|
|
* @return WP_Block_Type|false |
44
|
|
|
*/ |
45
|
|
|
public function registerBlock() |
46
|
|
|
{ |
47
|
|
|
$wp_block_type = register_block_type( |
48
|
|
|
new WP_Block_Type( |
49
|
|
|
$this->editorBlockType(), |
50
|
|
|
array( |
51
|
|
|
'editor_script' => 'ee-event-editor-blocks', |
52
|
|
|
'editor_style' => 'ee-block-styles', |
53
|
|
|
'attributes' => array(), |
54
|
|
|
) |
55
|
|
|
) |
56
|
|
|
); |
57
|
|
|
$this->setWpBlockType($wp_block_type); |
58
|
|
|
return $wp_block_type; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @return array |
64
|
|
|
*/ |
65
|
|
|
public function getEditorContainer() |
66
|
|
|
{ |
67
|
|
|
return array( |
68
|
|
|
$this->editorBlockType(), |
69
|
|
|
array() |
70
|
|
|
); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @return void |
76
|
|
|
*/ |
77
|
|
|
public function registerScripts() |
78
|
|
|
{ |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @return void |
84
|
|
|
*/ |
85
|
|
|
public function registerStyles() |
86
|
|
|
{ |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* returns the rendered HTML for the block |
92
|
|
|
* |
93
|
|
|
* @param array $attributes |
94
|
|
|
* @return string |
95
|
|
|
*/ |
96
|
|
|
public function renderBlock(array $attributes = array()) |
97
|
|
|
{ |
98
|
|
|
return ''; |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|