/var/www/html_us/wp-content/plugins/woocommerce/src/Admin/BlockTemplates/BlockInterface.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php

namespace Automattic\WooCommerce\Admin\BlockTemplates;

/**
 * Interface for block configuration used to specify blocks in BlockTemplate.
 */
interface BlockInterface {
    
/**
     * Key for the block name in the block configuration.
     */
    
public const NAME_KEY 'blockName';

    
/**
     * Key for the block ID in the block configuration.
     */
    
public const ID_KEY 'id';

    
/**
     * Key for the internal order in the block configuration.
     */
    
public const ORDER_KEY 'order';

    
/**
     * Key for the block attributes in the block configuration.
     */
    
public const ATTRIBUTES_KEY 'attributes';

    
/**
     * Key for the block hide conditions in the block configuration.
     */
    
public const HIDE_CONDITIONS_KEY 'hideConditions';

    
/**
     * Key for the block disable conditions in the block configuration.
     */
    
public const DISABLE_CONDITIONS_KEY 'disableConditions';

    
/**
     * Get the block name.
     */
    
public function get_name(): string;

    
/**
     * Get the block ID.
     */
    
public function get_id(): string;

    
/**
     * Get the block order.
     */
    
public function get_order(): int;

    
/**
     * Set the block order.
     *
     * @param int $order The block order.
     */
    
public function set_orderint $order );

    
/**
     * Get the block attributes.
     */
    
public function get_attributes(): array;

    
/**
     * Set the block attributes.
     *
     * @param array $attributes The block attributes.
     */
    
public function set_attributes( array $attributes );

    
/**
     * Set a block attribute value without replacing the entire attributes object.
     *
     * @param string $key The attribute key.
     * @param mixed  $value The attribute value.
     */
    
public function set_attributestring $key$value );

    
/**
     * Get the parent container that the block belongs to.
     */
    
public function &get_parent(): ContainerInterface;

    
/**
     * Get the root template that the block belongs to.
     */
    
public function &get_root_template(): BlockTemplateInterface;

    
/**
     * Remove the block from its parent.
     */
    
public function remove();

    
/**
     * Check if the block is detached from its parent or root template.
     *
     * @return bool True if the block is detached from its parent or root template.
     */
    
public function is_detached(): bool;

    
/**
     * Add a hide condition to the block.
     *
     * The hide condition is a JavaScript-like expression that will be evaluated on the client to determine if the block should be hidden.
     * See [@woocommerce/expression-evaluation](https://github.com/woocommerce/woocommerce/blob/trunk/packages/js/expression-evaluation/README.md) for more details.
     *
     * @param string $expression An expression, which if true, will hide the block.
     * @return string The key of the hide condition, which can be used to remove the hide condition.
     */
    
public function add_hide_conditionstring $expression ): string;

    
/**
     * Remove a hide condition from the block.
     *
     * @param string $key The key of the hide condition to remove.
     */
    
public function remove_hide_conditionstring $key );

    
/**
     * Get the hide conditions of the block.
     */
    
public function get_hide_conditions(): array;

    
/**
     * Add a disable condition to the block.
     *
     * The disable condition is a JavaScript-like expression that will be evaluated on the client to determine if the block should be disabled.
     * See [@woocommerce/expression-evaluation](https://github.com/woocommerce/woocommerce/blob/trunk/packages/js/expression-evaluation/README.md) for more details.
     *
     * @param string $expression An expression, which if true, will disable the block.
     * @return string The key of the disable condition, which can be used to remove the disable condition.
     */
    
public function add_disable_conditionstring $expression ): string;

    
/**
     * Remove a disable condition from the block.
     *
     * @param string $key The key of the disable condition to remove.
     */
    
public function remove_disable_conditionstring $key );

    
/**
     * Get the disable conditions of the block.
     */
    
public function get_disable_conditions(): array;

    
/**
     * Get the block configuration as a formatted template.
     *
     * @return array The block configuration as a formatted template.
     */
    
public function get_formatted_template(): array;
}