Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
imageapi_optimize
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
imageapi_optimize
Commits
20848145
Commit
20848145
authored
8 years ago
by
Steven Jones
Committed by
Steven Jones
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2805031
by Steven Jones: Modify image style list to display pipeline used
parent
34b02d52
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
imageapi_optimize.module
+2
-1
2 additions, 1 deletion
imageapi_optimize.module
src/Entity/ImageStyleWithPipeline.php
+3
-0
3 additions, 0 deletions
src/Entity/ImageStyleWithPipeline.php
src/ImageStyleWithPipelineListBuilder.php
+29
-0
29 additions, 0 deletions
src/ImageStyleWithPipelineListBuilder.php
with
34 additions
and
1 deletion
imageapi_optimize.module
+
2
−
1
View file @
20848145
...
...
@@ -40,7 +40,8 @@ function imageapi_optimize_entity_type_alter(array &$entity_types) {
/** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
if
(
isset
(
$entity_types
[
'image_style'
]))
{
$image_style
=
$entity_types
[
'image_style'
];
$image_style
->
setClass
(
'\Drupal\imageapi_optimize\Entity\ImageStyleWithPipeline'
);
$image_style
->
setClass
(
'Drupal\imageapi_optimize\Entity\ImageStyleWithPipeline'
);
$image_style
->
setHandlerClass
(
'list_builder'
,
'Drupal\imageapi_optimize\ImageStyleWithPipelineListBuilder'
);
$config_export
=
$image_style
->
get
(
'config_export'
);
$config_export
[]
=
'pipeline'
;
$image_style
->
set
(
'config_export'
,
$config_export
);
...
...
This diff is collapsed.
Click to expand it.
src/Entity/ImageStyleWithPipeline.php
+
3
−
0
View file @
20848145
...
...
@@ -9,6 +9,9 @@ class ImageStyleWithPipeline extends ImageStyle {
//@TODO: maybe this should be something other than a 'random' string.
protected
$pipeline
=
'__default__'
;
/**
* {@inheritdoc}
*/
public
function
createDerivative
(
$original_uri
,
$derivative_uri
)
{
$result
=
parent
::
createDerivative
(
$original_uri
,
$derivative_uri
);
...
...
This diff is collapsed.
Click to expand it.
src/ImageStyleWithPipelineListBuilder.php
0 → 100644
+
29
−
0
View file @
20848145
<?php
namespace
Drupal\imageapi_optimize
;
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\image\ImageStyleListBuilder
;
class
ImageStyleWithPipelineListBuilder
extends
ImageStyleListBuilder
{
/**
* {@inheritdoc}
*/
public
function
buildHeader
()
{
$header
=
parent
::
buildHeader
();
$header
[
'pipeline'
]
=
$this
->
t
(
'Image Optimize Pipeline'
);
return
$header
;
}
/**
* {@inheritdoc}
*/
public
function
buildRow
(
EntityInterface
$entity
)
{
/** @var \Drupal\imageapi_optimize\Entity\ImageStyleWithPipeline $entity */
$pipelineNames
=
imageapi_optimize_pipeline_options
(
FALSE
);
$row
=
parent
::
buildRow
(
$entity
);
$row
[
'pipeline'
]
=
isset
(
$pipelineNames
[
$entity
->
getPipeline
()])
?
$pipelineNames
[
$entity
->
getPipeline
()]
:
''
;
return
$row
;
}
}
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