Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
views_bootstrap
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
views_bootstrap
Commits
ee296463
Commit
ee296463
authored
1 year ago
by
Shelane French
Committed by
Shelane French
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3024039
by shelane, gnikolovski, pixiekat, tguerineau: Provide class on the parent of rows
parent
41fd8cf0
No related branches found
No related tags found
No related merge requests found
Pipeline
#186328
passed with warnings
1 year ago
Stage: build
Stage: validate
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Plugin/views/style/ViewsBootstrapGrid.php
+14
-13
14 additions, 13 deletions
src/Plugin/views/style/ViewsBootstrapGrid.php
views_bootstrap.theme.inc
+8
-1
8 additions, 1 deletion
views_bootstrap.theme.inc
with
22 additions
and
14 deletions
src/Plugin/views/style/ViewsBootstrapGrid.php
+
14
−
13
View file @
ee296463
...
...
@@ -41,22 +41,11 @@ class ViewsBootstrapGrid extends StylePluginBase {
protected
function
defineOptions
()
{
$options
=
parent
::
defineOptions
();
$options
[
'grid_class'
]
=
[
'default'
=>
''
];
foreach
(
ViewsBootstrap
::
getBreakpoints
()
as
$breakpoint
)
{
$breakpoint_option
=
"col_
$breakpoint
"
;
$options
[
$breakpoint_option
]
=
[
'default'
=>
'none'
];
}
$options
[
'col_class_custom'
]
=
[
'default'
=>
''
];
$options
[
'col_class_default'
]
=
[
'default'
=>
TRUE
];
$options
[
'row_class_custom'
]
=
[
'default'
=>
''
];
$options
[
'row_class_default'
]
=
[
'default'
=>
TRUE
];
$options
[
'default'
]
=
[
'default'
=>
''
];
$options
[
'info'
]
=
[
'default'
=>
[]];
$options
[
'override'
]
=
[
'default'
=>
TRUE
];
$options
[
'sticky'
]
=
[
'default'
=>
FALSE
];
$options
[
'order'
]
=
[
'default'
=>
'asc'
];
$options
[
'caption'
]
=
[
'default'
=>
''
];
$options
[
'summary'
]
=
[
'default'
=>
''
];
$options
[
'description'
]
=
[
'default'
=>
''
];
return
$options
;
}
...
...
@@ -66,13 +55,25 @@ class ViewsBootstrapGrid extends StylePluginBase {
public
function
buildOptionsForm
(
&
$form
,
FormStateInterface
$form_state
)
{
parent
::
buildOptionsForm
(
$form
,
$form_state
);
$form
[
'grid_class'
]
=
[
'#title'
=>
$this
->
t
(
'Grid row custom class'
),
'#description'
=>
$this
->
t
(
'Additional classes to provide on the grid row. Separated by a space.'
),
'#type'
=>
'textfield'
,
'#size'
=>
'30'
,
'#default_value'
=>
$this
->
options
[
'grid_class'
],
'#weight'
=>
1
,
];
$form
[
'row_class'
][
'#title'
]
=
$this
->
t
(
'Custom column class'
);
$form
[
'row_class'
][
'#weight'
]
=
2
;
foreach
(
ViewsBootstrap
::
getBreakpoints
()
as
$breakpoint
)
{
$breakpoint_option
=
"col_
$breakpoint
"
;
$prefix
=
'col'
.
(
$breakpoint
!=
'xs'
?
'-'
.
$breakpoint
:
''
);
$form
[
$breakpoint_option
]
=
[
'#type'
=>
'select'
,
'#title'
=>
$this
->
t
(
"Column width of items at @breakpoint breakpoint"
,
[
'@breakpoint'
=>
$breakpoint
]),
'#default_value'
=>
isset
(
$this
->
options
[
$breakpoint_option
]
)
?
$this
->
options
[
$breakpoint_option
]
:
NULL
,
'#default_value'
=>
$this
->
options
[
$breakpoint_option
]
?
?
NULL
,
'#description'
=>
$this
->
t
(
"Set the number of columns each item should take up at the @breakpoint breakpoint and higher."
,
[
'@breakpoint'
=>
$breakpoint
]),
'#options'
=>
[
'none'
=>
$this
->
t
(
'None (or inherit from previous)'
),
...
...
This diff is collapsed.
Click to expand it.
views_bootstrap.theme.inc
+
8
−
1
View file @
ee296463
...
...
@@ -5,6 +5,7 @@
* Preprocessors and helper functions to make theming easier.
*/
use
Drupal\Component\Utility\Html
;
use
Drupal\views_bootstrap
\ViewsBootstrap
;
use
Drupal\Core\Template\Attribute
;
...
...
@@ -132,9 +133,15 @@ function template_preprocess_views_bootstrap_carousel(array &$vars) {
function
template_preprocess_views_bootstrap_grid
(
array
&
$vars
)
{
$view
=
$vars
[
'view'
];
$vars
[
'id'
]
=
ViewsBootstrap
::
getUniqueId
(
$view
);
$vars
[
'attributes'
][
'class'
][]
=
'grid'
;
$vars
[
'attributes'
]
=
new
Attribute
(
[
'class'
=
>
'grid'
])
;
$options
=
$view
->
style_plugin
->
options
;
if
(
$options
[
'grid_class'
])
{
$grid_class
=
explode
(
' '
,
$options
[
'grid_class'
]);
$grid_classes
=
array_map
([
Html
::
class
,
'cleanCssIdentifier'
],
array_filter
(
$grid_class
));
$vars
[
'attributes'
]
->
addClass
(
$grid_classes
);
}
$vars
[
'row_attributes'
]
=
new
Attribute
();
foreach
(
ViewsBootstrap
::
getBreakpoints
()
as
$breakpoint
)
{
if
(
$options
[
"col_
$breakpoint
"
]
==
'none'
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment