Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
image_canvas_editor_api
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
image_canvas_editor_api
Commits
2daf4e46
Commit
2daf4e46
authored
7 years ago
by
Eirik Morland
Browse files
Options
Downloads
Patches
Plain Diff
Make it possible to alter the rendered editor.
parent
805dd384
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Controller/EditorController.php
+8
-9
8 additions, 9 deletions
src/Controller/EditorController.php
with
8 additions
and
9 deletions
src/Controller/EditorController.php
+
8
−
9
View file @
2daf4e46
...
...
@@ -3,10 +3,8 @@
namespace
Drupal\image_canvas_editor_api\Controller
;
use
Drupal\Core\Controller\ControllerBase
;
use
Drupal\Core\Datetime\DateFormatterInterface
;
use
Drupal\Core\Entity\EntityStorageInterface
;
use
Drupal\Core\Entity\EntityTypeManagerInterface
;
use
Drupal\Core\
Url
;
use
Drupal\Core\
Extension\ModuleHandlerInterface
;
use
Drupal\image_canvas_editor_api
\Plugin\EditorPluginManager
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Symfony\Component\HttpFoundation\JsonResponse
;
...
...
@@ -28,13 +26,11 @@ class EditorController extends ControllerBase {
/**
* Constructs the controller object.
*
* @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
* The date formatter service.
*/
public
function
__construct
(
EntityTypeManagerInterface
$entity_manager
,
EditorPluginManager
$manager
)
{
public
function
__construct
(
EntityTypeManagerInterface
$entity_manager
,
EditorPluginManager
$manager
,
ModuleHandlerInterface
$module_handler
)
{
$this
->
entityTypeManager
=
$entity_manager
;
$this
->
pluginManager
=
$manager
;
$this
->
moduleHandler
=
$module_handler
;
}
/**
...
...
@@ -43,7 +39,8 @@ class EditorController extends ControllerBase {
public
static
function
create
(
ContainerInterface
$container
)
{
return
new
static
(
$container
->
get
(
'entity_type.manager'
),
$container
->
get
(
'plugin.manager.image_editor_plugin'
)
$container
->
get
(
'plugin.manager.image_editor_plugin'
),
$container
->
get
(
'module_handler'
)
);
}
...
...
@@ -75,7 +72,9 @@ class EditorController extends ControllerBase {
/** @var \Drupal\file\Entity\File $file */
$image_url
=
file_create_url
(
$file
->
getFileUri
());
$build
[
'editor'
]
=
$instance
->
renderEditor
(
$image_url
);
$editor
=
$instance
->
renderEditor
(
$image_url
);
$this
->
moduleHandler
->
alter
(
'image_canvas_editor_api_editor_render'
,
$editor
);
$build
[
'editor'
]
=
$editor
;
$build
[
'save'
]
=
[
'#type'
=>
'inline_template'
,
'#template'
=>
'<button class="btn button image-canvas-editor-save">{{ save }}</button>'
,
...
...
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