You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Block Library - Query Loop]: Add allowedControls in block variations for better extensibility (#43632)
* allowedControls in Query Loop variations
* allow empty array as value of allowedControls
* remove test variation
* move to utils
* allow to hide the 'inherit' control
* fix typo
'Toggle to use the global query context that is set with the current template, such as an archive or search. Disable to customize the settings independently.'
118
+
{showSettingsPanel&&(
119
+
<InspectorControls>
120
+
<PanelBodytitle={__('Settings')}>
121
+
{showInheritControl&&(
122
+
<ToggleControl
123
+
label={__('Inherit query from template')}
124
+
help={__(
125
+
'Toggle to use the global query context that is set with the current template, such as an archive or search. Disable to customize the settings independently.'
126
+
)}
127
+
checked={!!inherit}
128
+
onChange={(value)=>
129
+
setQuery({inherit: !!value})
130
+
}
131
+
/>
113
132
)}
114
-
checked={!!inherit}
115
-
onChange={(value)=>
116
-
setQuery({inherit: !!value})
117
-
}
118
-
/>
119
-
{!inherit&&(
120
-
<SelectControl
121
-
options={postTypesSelectOptions}
122
-
value={postType}
123
-
label={__('Post type')}
124
-
onChange={onPostTypeChange}
125
-
help={__(
126
-
'WordPress contains different types of content and they are divided into collections called "Post types". By default there are a few different ones such as blog posts and pages, but plugins could add more.'
127
-
)}
128
-
/>
129
-
)}
130
-
{displayLayout?.type==='flex'&&(
131
-
<>
132
-
<RangeControl
133
-
label={__('Columns')}
134
-
value={displayLayout.columns}
133
+
{showPostTypeControl&&(
134
+
<SelectControl
135
+
options={postTypesSelectOptions}
136
+
value={postType}
137
+
label={__('Post type')}
138
+
onChange={onPostTypeChange}
139
+
help={__(
140
+
'WordPress contains different types of content and they are divided into collections called "Post types". By default there are a few different ones such as blog posts and pages, but plugins could add more.'
141
+
)}
142
+
/>
143
+
)}
144
+
{showColumnsControl&&(
145
+
<>
146
+
<RangeControl
147
+
label={__('Columns')}
148
+
value={displayLayout.columns}
149
+
onChange={(value)=>
150
+
setDisplayLayout({columns: value})
151
+
}
152
+
min={2}
153
+
max={Math.max(6,displayLayout.columns)}
154
+
/>
155
+
{displayLayout.columns>6&&(
156
+
<Notice
157
+
status="warning"
158
+
isDismissible={false}
159
+
>
160
+
{__(
161
+
'This column count exceeds the recommended amount and may cause visual breakage.'
162
+
)}
163
+
</Notice>
164
+
)}
165
+
</>
166
+
)}
167
+
{showOrderControl&&(
168
+
<OrderControl
169
+
{ ...{ order, orderBy }}
170
+
onChange={setQuery}
171
+
/>
172
+
)}
173
+
{showStickyControl&&(
174
+
<StickyControl
175
+
value={sticky}
135
176
onChange={(value)=>
136
-
setDisplayLayout({columns: value})
177
+
setQuery({sticky: value})
137
178
}
138
-
min={2}
139
-
max={Math.max(6,displayLayout.columns)}
140
179
/>
141
-
{displayLayout.columns>6&&(
142
-
<Notice
143
-
status="warning"
144
-
isDismissible={false}
145
-
>
146
-
{__(
147
-
'This column count exceeds the recommended amount and may cause visual breakage.'
148
-
)}
149
-
</Notice>
150
-
)}
151
-
</>
152
-
)}
153
-
{!inherit&&(
154
-
<OrderControl
155
-
{ ...{ order, orderBy }}
156
-
onChange={setQuery}
157
-
/>
158
-
)}
159
-
{!inherit&&showSticky&&(
160
-
<StickyControl
161
-
value={sticky}
162
-
onChange={(value)=>
163
-
setQuery({sticky: value})
164
-
}
165
-
/>
166
-
)}
167
-
</PanelBody>
168
-
</InspectorControls>
180
+
)}
181
+
</PanelBody>
182
+
</InspectorControls>
183
+
)}
169
184
{!inherit&&(
170
185
<InspectorControls>
171
186
<ToolsPanel
@@ -181,58 +196,69 @@ export default function QueryInspectorControls( {
0 commit comments