@@ -253,6 +253,37 @@ function headless_settings_form($form, &$form_state) {
253
253
'#default_value ' => _headless_get_default_options ('blocks ' ),
254
254
'#js_select ' => FALSE ,
255
255
);
256
+
257
+ if (empty ($ paragraphs_types )) {
258
+ $ form ['paragraphs ' ]['paragraphs-empty ' ] = array (
259
+ '#markup ' => t ('No paragraphs defined yet. <a href="@url">Manage paragraph types</a> ' , array ('@url ' => url ('admin/structure/paragraphs ' ))),
260
+ );
261
+ }
262
+ else {
263
+ $ paragraphs_type_header = array (
264
+ 'paragraph ' => t ('paragraph ' ),
265
+ 'endpoint ' => t ('End point ' ),
266
+ );
267
+ foreach ($ paragraphs_types as $ key => $ type ) {
268
+ $ paragraphs_type_options [$ key ] = array (
269
+ 'paragraph ' => $ type ->name ,
270
+ 'endpoint ' => array (
271
+ 'data ' => array (
272
+ '#type ' => 'link ' ,
273
+ '#title ' => '/api/paragraphs/ ' . $ key . '/{id} ' ,
274
+ '#href ' => '/api/paragraphs/ ' . $ key . '/{id} ' ,
275
+ ),
276
+ ),
277
+ );
278
+ }
279
+ $ form ['paragraphs ' ]['paragraphs-checkboxes ' ] = array (
280
+ '#type ' => 'tableselect ' ,
281
+ '#header ' => $ paragraphs_type_header ,
282
+ '#options ' => $ paragraphs_type_options ,
283
+ '#default_value ' => _headless_get_default_options ('paragraphs ' ),
284
+ '#js_select ' => FALSE ,
285
+ );
286
+ }
256
287
}
257
288
258
289
$ form ['actions ' ] = array ('#type ' => 'actions ' );
0 commit comments