Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
photoswipe-3270757
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
0
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
photoswipe-3270757
Commits
0636fded
Commit
0636fded
authored
6 years ago
by
Julian Pustkuchen
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2936119
by ChuckSimply, Anybody: Hide Additional Images (D8): Fatal Error
parent
dd5baec9
No related branches found
Branches containing commit
Tags
7.x-2.0-beta1
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
photoswipe.theme.inc
+8
-6
8 additions, 6 deletions
photoswipe.theme.inc
src/Plugin/Field/FieldFormatter/PhotoswipeFieldFormatter.php
+6
-6
6 additions, 6 deletions
src/Plugin/Field/FieldFormatter/PhotoswipeFieldFormatter.php
with
14 additions
and
12 deletions
photoswipe.theme.inc
+
8
−
6
View file @
0636fded
...
...
@@ -76,7 +76,7 @@ function template_preprocess_photoswipe_image_formatter(array &$variables)
}
// Render as a standard image if an image style is not given.
if
(
empty
(
$image
[
'#style_name'
]))
{
if
(
empty
(
$image
[
'#style_name'
])
||
$image
[
'#style_name'
]
===
'hide'
)
{
$image
[
'#theme'
]
=
'image'
;
}
...
...
@@ -125,9 +125,11 @@ function template_preprocess_photoswipe_image_formatter(array &$variables)
$variables
[
'image'
]
=
$image
;
$variables
[
'path'
]
=
$path
;
$variables
[
'attributes'
]
=
[
'class'
=>
'photoswipe'
,
'data-size'
=>
$dimensions
[
'width'
]
.
'x'
.
$dimensions
[
'height'
],
'data-overlay-title'
=>
$caption
,
];
$variables
[
'attributes'
][
'class'
][]
=
'photoswipe'
;
$variables
[
'attributes'
][
'data-size'
]
=
$dimensions
[
'width'
]
.
'x'
.
$dimensions
[
'height'
];
$variables
[
'attributes'
][
'data-overlay-title'
]
=
$caption
;
if
(
$image
[
'#style_name'
]
===
'hide'
){
// Do not display if hidden is selected:
$variables
[
'attributes'
][
'class'
][]
=
'hidden'
;
}
}
This diff is collapsed.
Click to expand it.
src/Plugin/Field/FieldFormatter/PhotoswipeFieldFormatter.php
+
6
−
6
View file @
0636fded
...
...
@@ -67,9 +67,9 @@ class PhotoswipeFieldFormatter extends FormatterBase {
// Set our caption options.
$caption_options
=
[
'title'
=>
$this
->
t
(
'Image
T
itle
T
ag'
),
'alt'
=>
$this
->
t
(
'Image
A
lt
T
ag'
),
'node_title'
=>
$this
->
t
(
'
Node T
itle'
),
'title'
=>
$this
->
t
(
'Image
t
itle
t
ag'
),
'alt'
=>
$this
->
t
(
'Image
a
lt
t
ag'
),
'node_title'
=>
$this
->
t
(
'
Entity t
itle'
),
];
// Add the other node fields as options.
if
(
!
empty
(
$form
[
'#fields'
]))
{
...
...
@@ -137,9 +137,9 @@ class PhotoswipeFieldFormatter extends FormatterBase {
if
(
$this
->
getSetting
(
'photoswipe_caption'
))
{
$caption_options
=
[
'alt'
=>
$this
->
t
(
'Image
A
lt
T
ag'
),
'title'
=>
$this
->
t
(
'Image
T
itle
T
ag'
),
'node_title'
=>
$this
->
t
(
'
Node T
itle'
),
'alt'
=>
$this
->
t
(
'Image
a
lt
t
ag'
),
'title'
=>
$this
->
t
(
'Image
t
itle
t
ag'
),
'node_title'
=>
$this
->
t
(
'
Entity t
itle'
),
];
if
(
array_key_exists
(
$this
->
getSetting
(
'photoswipe_caption'
),
$caption_options
))
{
$caption_setting
=
$caption_options
[
$this
->
getSetting
(
'photoswipe_caption'
)];
...
...
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