Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
views_fieldsets
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_fieldsets
Commits
8371d920
Commit
8371d920
authored
1 year ago
by
Stephen Mustgrave
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3166744
: Views override
parent
693bf5b4
No related branches found
No related tags found
1 merge request
!10
Issue #3166744: Views override
Pipeline
#18193
passed
1 year ago
Stage: build
Stage: validate
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/RowFieldset.php
+36
-2
36 additions, 2 deletions
src/RowFieldset.php
views_fieldsets.module
+15
-0
15 additions, 0 deletions
views_fieldsets.module
with
51 additions
and
2 deletions
src/RowFieldset.php
+
36
−
2
View file @
8371d920
...
...
@@ -105,9 +105,8 @@ class RowFieldset {
}
}
}
// @todo Theme hook suggestions!
$element
=
[
'#theme'
=>
'views_fieldsets_'
.
$this
->
getWrapperType
(),
'#theme'
=>
$this
->
themeFunctions
(
$this
->
getWrapperType
()
)
,
'#fields'
=>
$this
->
children
,
'#show_fieldset'
=>
$show_fieldset
,
'#legend'
=>
Markup
::
create
(
$this
->
getLegend
()),
...
...
@@ -176,4 +175,39 @@ class RowFieldset {
$this
->
children
[
$field_name
]
=
$fields
[
$field_name
];
}
/**
* Generate a list of theme hook suggestions.
*
* @param string $type
* Fieldset type.
*
* @return array
* List of theme suggestions.
*/
public
function
themeFunctions
(
string
$type
):
array
{
$themes
=
[];
$hook
=
'views_fieldsets_'
.
$type
;
$display
=
$this
->
handler
->
view
->
display_handler
->
display
;
if
(
!
empty
(
$display
))
{
$themes
[]
=
$hook
.
'__'
.
$this
->
handler
->
view
->
storage
->
id
()
.
'__'
.
$display
[
'id'
]
.
'__'
.
$this
->
handler
->
options
[
'id'
];
$themes
[]
=
$hook
.
'__'
.
$this
->
handler
->
view
->
storage
->
id
()
.
'__'
.
$display
[
'id'
];
$themes
[]
=
$hook
.
'__'
.
$display
[
'id'
]
.
'__'
.
$this
->
handler
->
options
[
'id'
];
$themes
[]
=
$hook
.
'__'
.
$display
[
'id'
];
if
(
$display
[
'id'
]
!=
$display
[
'display_plugin'
])
{
$themes
[]
=
$hook
.
'__'
.
$this
->
handler
->
view
->
storage
->
id
()
.
'__'
.
$display
[
'display_plugin'
]
.
'__'
.
$this
->
handler
->
options
[
'id'
];
$themes
[]
=
$hook
.
'__'
.
$this
->
handler
->
view
->
storage
->
id
()
.
'__'
.
$display
[
'display_plugin'
];
$themes
[]
=
$hook
.
'__'
.
$display
[
'display_plugin'
]
.
'__'
.
$this
->
handler
->
options
[
'id'
];
$themes
[]
=
$hook
.
'__'
.
$display
[
'display_plugin'
];
}
}
$themes
[]
=
$hook
.
'__'
.
$this
->
handler
->
view
->
storage
->
id
()
.
'__'
.
$this
->
handler
->
options
[
'id'
];
$themes
[]
=
$hook
.
'__'
.
$this
->
handler
->
view
->
storage
->
id
();
$themes
[]
=
$hook
.
'__'
.
$this
->
handler
->
options
[
'id'
];
$themes
[]
=
$hook
;
return
$themes
;
}
}
This diff is collapsed.
Click to expand it.
views_fieldsets.module
+
15
−
0
View file @
8371d920
...
...
@@ -245,3 +245,18 @@ function views_fieldsets_views_ui_rearrange_form_submit($form, $form_state) {
$display
->
setOption
(
'fields'
,
$display_fields
);
$ui_view
->
cacheSet
();
}
/**
* Implements hook_theme_suggestions_HOOK().
*/
function
views_fieldsets_theme_suggestions_paragraph
(
array
$variables
)
{
$suggestions
=
[];
$paragraph
=
$variables
[
'elements'
][
'#paragraph'
];
$sanitized_view_mode
=
strtr
(
$variables
[
'elements'
][
'#view_mode'
],
'.'
,
'_'
);
$suggestions
[]
=
'paragraph__'
.
$sanitized_view_mode
;
$suggestions
[]
=
'paragraph__'
.
$paragraph
->
bundle
();
$suggestions
[]
=
'paragraph__'
.
$paragraph
->
bundle
()
.
'__'
.
$sanitized_view_mode
;
return
$suggestions
;
}
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