Skip to content
Snippets Groups Projects

Add wrapper class option to grid style.

3 files
+ 21
15
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -41,6 +41,7 @@ class ViewsBootstrapGrid extends StylePluginBase {
protected function defineOptions() {
$options = parent::defineOptions();
$options['wrapper_class'] = ['default' => ''];
foreach (ViewsBootstrap::getBreakpoints() as $breakpoint) {
$breakpoint_option = "col_$breakpoint";
$options[$breakpoint_option] = ['default' => 'none'];
@@ -66,6 +67,13 @@ class ViewsBootstrapGrid extends StylePluginBase {
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['wrapper_class'] = [
'#type' => 'textfield',
'#title' => $this->t('Wrapper class'),
'#default_value' => $this->options['wrapper_class'],
'#description' => $this->t('Add a class to the .row element surrounding the results. <a href="https://getbootstrap.com/docs/4.5/utilities/flex/" target="_blank">Bootstrap\'s flex utilities</a>, for example.'),
];
foreach (ViewsBootstrap::getBreakpoints() as $breakpoint) {
$breakpoint_option = "col_$breakpoint";
$prefix = 'col' . ($breakpoint != 'xs' ? '-' . $breakpoint : '');
Loading