Skip to content

Commit

Permalink
Add vertical tab summary
Browse files Browse the repository at this point in the history
  • Loading branch information
argiepiano committed May 22, 2022
1 parent 87e38db commit 9668fab
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
31 changes: 31 additions & 0 deletions og_ui/js/og_ui.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
(function ($) {

Backdrop.behaviors.ogUiContentTypes = {
// Provide the vertical tab summaries for OG.
attach: function (context) {console.log('loaded');
var $context = $(context);
$context.find('fieldset#edit-og').backdropSetSummary(function() {console.log('found it')
var vals = [];
if ($context.find('input[name="og_group_type"]:checked').length) {
vals.push(Backdrop.t('Is a "Group" content type'));
}

if ($context.find('input[name="og_group_content_type"]:checked').length) {
vals.push(Backdrop.t('Is a "Group content" content type'));
var target_type = $context.find('select[name="target_type"]').find('option:selected').text();
console.log(target_type);
if (target_type) {
vals.push(Backdrop.t('Target type: ' + target_type));
}
var target_bundles = $context.find('select[name="target_bundles[]"]').find('option:selected').toArray().map(item => item.text).join();
if (target_bundles) {
vals.push(Backdrop.t('Target bundles: ' + target_bundles));
}
}

return vals.length ? vals.join(', ') : Backdrop.t('Not set');
});
}
};

})(jQuery);
3 changes: 3 additions & 0 deletions og_ui/og_ui.module
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,9 @@ function og_ui_form_node_type_form_alter(&$form, &$form_state) {
'#collapsible' => TRUE,
'#group' => 'additional_settings',
'#description' => t('Specify how OG should treat content of this type. Content may behave as a group, as group content, or may not participate in OG at all.'),
'#attached' => array(
'js' => array(backdrop_get_path('module', 'og_ui') . '/js/og_ui.js'),
),
);

// Group settings.
Expand Down

0 comments on commit 9668fab

Please sign in to comment.