Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
ds-3426115
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
ds-3426115
Commits
9619365b
Commit
9619365b
authored
6 years ago
by
Kristof De Jaeger
Browse files
Options
Downloads
Patches
Plain Diff
Sanitize $_GET['v']
parent
17a9800e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/ds_extras/ds_extras.module
+19
-0
19 additions, 0 deletions
modules/ds_extras/ds_extras.module
modules/ds_extras/ds_extras.pages.inc
+6
-0
6 additions, 0 deletions
modules/ds_extras/ds_extras.pages.inc
with
25 additions
and
0 deletions
modules/ds_extras/ds_extras.module
+
19
−
0
View file @
9619365b
...
...
@@ -516,6 +516,25 @@ function ds_extras_get_view_mode() {
return
drupal_static
(
'ds_extras_view_mode'
);
}
/**
* Get view modes for an entity bundle.
*/
function
ds_extras_get_bundle_view_modes
(
$type
,
$bundle
)
{
$view_modes
=
array
(
'default'
=>
t
(
'Default'
));
$view_mode_settings
=
field_view_mode_settings
(
$type
,
$bundle
);
$ds_vm
=
ds_entity_view_modes
(
$type
);
foreach
(
$ds_vm
as
$key
=>
$item
)
{
$overriden
=
(
!
empty
(
$view_mode_settings
[
$key
][
'custom_settings'
])
?
TRUE
:
FALSE
);
if
(
$overriden
)
{
$view_modes
[
$key
]
=
$item
[
'label'
];
}
}
return
$view_modes
;
}
/**
* Page title options for a full entity page view.
*/
...
...
This diff is collapsed.
Click to expand it.
modules/ds_extras/ds_extras.pages.inc
+
6
−
0
View file @
9619365b
...
...
@@ -29,6 +29,12 @@ function ds_extras_node_page_view($node) {
// It's also possible to use $_GET['v'] to switch view modes.
if
(
isset
(
$_GET
[
'v'
])
&&
!
empty
(
$_GET
[
'v'
]))
{
$view_mode
=
$_GET
[
'v'
];
// Check if this is a valid view mode, switch to default otherwise.
$view_modes
=
ds_extras_get_bundle_view_modes
(
'node'
,
$node
->
type
);
if
(
!
isset
(
$view_modes
[
$view_mode
]))
{
$view_mode
=
'full'
;
}
}
drupal_static
(
'ds_extras_view_mode'
,
$view_mode
);
return
node_view_multiple
(
array
(
$node
->
nid
=>
$node
),
$view_mode
);
...
...
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