Index: bootstrap_fieldgroup/templates/bootstrap-fieldgroup-horizontal.tpl.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- bootstrap_fieldgroup/templates/bootstrap-fieldgroup-horizontal.tpl.php	(date 1518136016000)
+++ bootstrap_fieldgroup/templates/bootstrap-fieldgroup-horizontal.tpl.php	(date 1518136016000)
@@ -0,0 +1,76 @@
+<?php if(!empty($items)):?>
+<div id="<?php print $wrapper_id; ?>" class="<?php print $wrapper_classes; ?>">
+  <?php
+  foreach ($items as $item){
+    if(isset($item['#access']) && $item['#access']==false) continue;
+    $label_title = false;
+    if(!empty($item['#title'])){
+      $label_title = (!empty($item['#label_display']) && $item['#label_display']=='hidden')?' ':$item['#title'];
+      $item['#title_display'] = 'invisible';
+      //hide label for mode form
+      $item['#label_display'] = 'hidden';
+    }
+    $lang = !empty($item['#language'])?$item['#language']:LANGUAGE_NONE;
+    if(!empty($item[$lang]['#title'])){
+      $label_title = $item[$lang]['#title'];
+      $item[$lang]['#title_display'] = 'invisible';
+      $item[$lang]['#label_display'] = 'hidden';
+    }
+    if(!empty($item[$lang][0]['#title'])){
+      $label_title = $item[$lang][0]['#title'];
+      $item[$lang][0]['#title_display'] = 'invisible';
+      $item[$lang][0]['#label_display'] = 'hidden';
+    }
+    if(!empty($item[$lang][0]['value'])){
+      if(!empty($item[$lang][0]['value']['#title'])){
+        $label_title = $item[$lang][0]['value']['#title'];
+        $item[$lang][0]['value']['#title_display'] = 'invisible';
+        $item[$lang][0]['value']['#label_display'] = 'hidden';
+      }
+    }
+    if(!empty($item[$lang][0]['value']['date']['#title'])) {
+      $label_title = $item[$lang][0]['value']['date']['#title'];
+      $item[$lang][0]['value']['date']['#title_display'] = 'invisible';
+    }
+    $label_element = 'label';
+    $label_attr = '';
+    $outer_element = 'div';
+    $outer_classes = $row_classes;
+    $outer_attr = '';
+    if (module_exists('ds') && !empty($item['#entity_type'])) {
+      // Add Display Suite fields and settings.
+      $fields_ds_settings = ds_get_field_settings($item['#entity_type'], $item['#bundle'], $item['#view_mode']);
+      // Allow to override field label using DS field format settings.
+      if (!empty($fields_ds_settings[$item['#field_name']]['formatter_settings']['ft']['lb'])) {
+        $label_title = t($fields_ds_settings[$item['#field_name']]['formatter_settings']['ft']['lb']);
+      }
+      if (!empty($fields_ds_settings[$item['#field_name']]['formatter_settings']['ft']['lb-el'])) {
+        $label_element = $fields_ds_settings[$item['#field_name']]['formatter_settings']['ft']['lb-el'];
+      }
+      if (!empty($fields_ds_settings[$item['#field_name']]['formatter_settings']['ft']['lb-cl'])) {
+        $label_classes .= ' '.$fields_ds_settings[$item['#field_name']]['formatter_settings']['ft']['lb-cl'];
+      }
+      if (!empty($fields_ds_settings[$item['#field_name']]['formatter_settings']['ft']['lb-at'])) {
+        $label_attr = $fields_ds_settings[$item['#field_name']]['formatter_settings']['ft']['lb-at'];
+      }
+      if (!empty($fields_ds_settings[$item['#field_name']]['formatter_settings']['ft']['ow-el'])) {
+        $outer_element = $fields_ds_settings[$item['#field_name']]['formatter_settings']['ft']['ow-el'];
+      }
+      if (!empty($fields_ds_settings[$item['#field_name']]['formatter_settings']['ft']['ow-cl'])) {
+        $outer_classes .= ' '.$fields_ds_settings[$item['#field_name']]['formatter_settings']['ft']['ow-cl'];
+      }
+      if (!empty($fields_ds_settings[$item['#field_name']]['formatter_settings']['ft']['ow-at'])) {
+        $outer_attr = $fields_ds_settings[$item['#field_name']]['formatter_settings']['ft']['ow-at'];
+      }
+    }
+    $render = drupal_render($item);
+    if(!empty($render)){
+      echo "<$outer_element class='$outer_classes' $outer_attr>";
+      echo $label_title?"<$label_element class='$label_classes' $label_attr>".$label_title."</$label_element>":'';
+      echo "  <div class='$input_classes'>$render</div>";
+      echo "</$outer_element>";
+    }
+  }
+  ?>
+</div>
+<?php endif?>
Index: bootstrap_fieldgroup/bootstrap_fieldgroup.module
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- bootstrap_fieldgroup/bootstrap_fieldgroup.module	(revision 2e310e95278ad233a88958fa62aa32da90767712)
+++ bootstrap_fieldgroup/bootstrap_fieldgroup.module	(date 1518135172000)
@@ -28,6 +28,10 @@
       'template' => 'templates/bootstrap-fieldgroup-accordion',
       'variables' => array('items' => array(), 'group' => NULL),
     ),
+    'bootstrap_fieldgroup_horizontal' => array(
+      'template' => 'templates/bootstrap-fieldgroup-horizontal',
+      'variables' => array('items' => array(), 'group' => NULL),
+    ),
   );
 }
 
@@ -94,6 +98,18 @@
     ),
   );
 
+  $formatters['bootstrap_fieldgroup_horizontal'] = array(
+    'label' => t('Bootstrap Horizontal form'),
+    'description' => t('This fieldgroup renders the label inside a Bootstrap column with the specified column classes.'),
+    'instance_settings' => array(
+      'classes' => '',
+      'bootstrap_label_col_xs' => '',
+      'bootstrap_label_col_sm' => '',
+      'bootstrap_label_col_md' => '',
+      'bootstrap_label_col_lg' => '',
+    ),
+  );
+
   foreach (array_keys($formatters) as $key) {
     $formatter = &$formatters[$key];
     $formatter['instance_settings']['required_fields'] = 1;
@@ -246,6 +262,13 @@
       $form['instance_settings']['bootstrap_grid_col_lg'] = _bootstrap_fieldgroup_grid_col_format_settings('lg', $group, $formatter);
       break;
 
+    case 'bootstrap_fieldgroup_horizontal':
+      $form['instance_settings']['bootstrap_label_col_xs'] = _bootstrap_fieldgroup_label_horizontal_format_settings('xs', $group, $formatter);
+      $form['instance_settings']['bootstrap_label_col_sm'] = _bootstrap_fieldgroup_label_horizontal_format_settings('sm', $group, $formatter);
+      $form['instance_settings']['bootstrap_label_col_md'] = _bootstrap_fieldgroup_label_horizontal_format_settings('md', $group, $formatter);
+      $form['instance_settings']['bootstrap_label_col_lg'] = _bootstrap_fieldgroup_label_horizontal_format_settings('lg', $group, $formatter);
+      break;
+
     default:
   }
 
@@ -303,6 +326,7 @@
 
     case 'bootstrap_fieldgroup_accordion':
     case 'bootstrap_fieldgroup_nav':
+    case 'bootstrap_fieldgroup_horizontal':
 
       $items = array();
       foreach ($group->children as $group_name) {
@@ -584,6 +608,78 @@
   );
 }
 
+function template_preprocess_bootstrap_fieldgroup_horizontal(&$variables) {
+  // Get the textual format of the the options available (xs, sm, md, lg).
+  $screen_size_texts = _bootstrap_grid_col_screens();
+  $settings = $variables['group']->format_settings['instance_settings'];
+  $mode = $variables['group']->mode;
+  $variables['wrapper_classes'] = $settings['classes'];
+  $variables['row_classes'] = 'row';
+  $label_classes = 'text-right ';
+  if($mode=='form'){
+    $variables['wrapper_classes'] .= ' form-horizontal';
+    $variables['row_classes'] = 'form-group';
+    $label_classes = 'control-label ';
+  }
+  $variables['wrapper_id'] = $variables['group']->group_name;
+  $input_classes = '';
+  foreach ($screen_size_texts as $screen_size => $text) {
+    if (!empty($settings['bootstrap_label_col_' . $screen_size])) {
+      $col = $settings['bootstrap_label_col_' . $screen_size];
+      $input_col = (12-$col)?12-$col:false;
+      $label_classes .= 'col-' . $screen_size . '-' . $col . ' ';
+      if($input_col){
+        $input_classes .= 'col-' . $screen_size . '-' . $input_col . ' ';
+      }
+    }
+  }
+
+  $variables['label_classes'] = $label_classes;
+  $variables['input_classes'] = $input_classes;
+}
+/**
+ * Implements field_group_pre_render_<format-type>.
+ * Format type: Bootstrap Horizontal form.
+ *
+ * @param $element The field group form element.
+ * @param $group The Field group object prepared for pre_render.
+ * @param $form The root element or form.
+ */
+function field_group_pre_render_bootstrap_fieldgroup_horizontal(&$element, $group, &$form) {
+  if ($group->format_type != 'bootstrap_fieldgroup_horizontal') {
+    return;
+  }
+  // Get the textual format of the the options available (xs, sm, md, lg).
+  $mode = $group->mode == 'form' ? 'form' : 'display';
+  $settings = $group->format_settings['instance_settings'];
+  // Create the element.
+  $element += array(
+    '#theme' => 'bootstrap_fieldgroup_horizontal',
+    '#mode' => $mode,
+    '#groups' => array_keys($form['#groups']),
+    '#settings' => $settings,
+  );
+}
+
+/**
+ * Helper function that returns the format settings array for the
+ * bootstrap_label_col_[xs,sm,md,lg] options used in bootstrap_fieldgroup_horizontal and
+ * bootstrap_label_col field group format types.
+ *
+ * @params string $screen The screen to which the option relates to (xs,sm,md,lg).
+ * @params object $group The Field group object.
+ * @params array $formatter The formatter used for the field group.
+ */
+function _bootstrap_fieldgroup_label_horizontal_format_settings($type, $group, $formatter) {
+  $screen_size_texts = _bootstrap_grid_col_screens();
+  $title = t('The number of columns the fieldgroup should label for ' . $screen_size_texts[$type] . ' screens.');
+  return array(
+    '#title' => $title,
+    '#type' => 'select',
+    '#options' => _bootstrap_grid_col_options(),
+    '#default_value' => isset($group->format_settings['instance_settings']['bootstrap_label_col_' . $type]) ? $group->format_settings['instance_settings']['bootstrap_label_col_' . $type] : $formatter['instance_settings']['bootstrap_label_col_' . $type],
+  );
+}
 /**
  * Helper function that returns the format settings array for the
  * bootstrap_grid_col_[xs,sm,md,lg] options used in bootstrap_grid_row and
