Skip to content

Commit fac00f0

Browse files
Merge pull request #31 from backdrop-contrib/robertgarrigos-patch-4
Issue #9
2 parents 3592ad5 + 4b6a27f commit fac00f0

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

includes/headless.admin.inc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,37 @@ function headless_settings_form($form, &$form_state) {
253253
'#default_value' => _headless_get_default_options('blocks'),
254254
'#js_select' => FALSE,
255255
);
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+
}
256287
}
257288

258289
$form['actions'] = array('#type' => 'actions');

0 commit comments

Comments
 (0)