Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
maxlength
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
maxlength
Commits
f9853249
Commit
f9853249
authored
1 year ago
by
Adam Nagy
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3375880
: Fix CKEditor5 library dependency.
parent
2e8a30ea
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
maxlength.libraries.yml
+0
-1
0 additions, 1 deletion
maxlength.libraries.yml
maxlength.module
+13
-0
13 additions, 0 deletions
maxlength.module
tests/src/Kernel/MaxLengthCkeditorTest.php
+54
-0
54 additions, 0 deletions
tests/src/Kernel/MaxLengthCkeditorTest.php
with
67 additions
and
1 deletion
maxlength.libraries.yml
+
0
−
1
View file @
f9853249
...
...
@@ -8,4 +8,3 @@ maxlength:
-
core/drupal
-
core/once
-
core/jquery
-
ckeditor5/internal.drupal.ckeditor5
This diff is collapsed.
Click to expand it.
maxlength.module
+
13
−
0
View file @
f9853249
...
...
@@ -239,3 +239,16 @@ function _maxlength_field_widget_form_alter_link_field(array &$element, FormStat
}
}
}
/**
* Implements hook_library_info_alter().
*/
function
maxlength_library_info_alter
(
&
$libraries
,
$extension
)
{
if
(
$extension
===
'maxlength'
)
{
// We only care about MaxLength.
$ckeditor5_enabled
=
\Drupal
::
moduleHandler
()
->
moduleExists
(
'ckeditor5'
);
if
(
$ckeditor5_enabled
)
{
$libraries
[
'maxlength'
][
'dependencies'
][]
=
'ckeditor5/internal.drupal.ckeditor5'
;
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tests/src/Kernel/MaxLengthCkeditorTest.php
0 → 100644
+
54
−
0
View file @
f9853249
<?php
declare
(
strict_types
=
1
);
namespace
Drupal\Tests\maxlength\Kernel
;
use
Drupal\KernelTests\KernelTestBase
;
/**
* Provides kernel tests MaxLength with CKEditor5.
*
* @group maxlength
*/
class
MaxLengthCkeditorTest
extends
KernelTestBase
{
/**
* {@inheritdoc}
*/
protected
static
$modules
=
[
'maxlength'
,
'field'
,
'user'
,
'system'
,
];
/**
* {@inheritdoc}
*/
protected
function
setUp
():
void
{
parent
::
setUp
();
$this
->
installConfig
([
'maxlength'
]);
}
/**
* Tests the CKEditor5 library dependency.
*
* @covers maxlength_library_info_alter()
*/
public
function
testCkeditor5LibraryDependency
()
{
// Get the library discovery service.
/** @var \Drupal\Core\Asset\LibraryDiscovery $libraryDiscovery */
$library_discovery
=
$this
->
container
->
get
(
'library.discovery'
);
$maxlength_library
=
$library_discovery
->
getLibraryByName
(
'maxlength'
,
'maxlength'
);
$this
->
assertNotContains
(
'ckeditor5/internal.drupal.ckeditor5'
,
$maxlength_library
[
'dependencies'
]);
// Now enable CKEditor5 module.
$this
->
container
->
get
(
'module_installer'
)
->
install
([
'ckeditor5'
]);
$library_discovery
->
clearCachedDefinitions
();
$maxlength_library
=
$library_discovery
->
getLibraryByName
(
'maxlength'
,
'maxlength'
);
$this
->
assertContains
(
'ckeditor5/internal.drupal.ckeditor5'
,
$maxlength_library
[
'dependencies'
]);
}
}
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