Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lite
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
lite
Merge requests
!1
Issue
#3230415
: Call to deprecated function libraries_detect():
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3230415
: Call to deprecated function libraries_detect():
issue/lite-3230415:8.x-1.x
into
8.x-1.x
Overview
0
Commits
12
Pipelines
0
Changes
6
Open
Shaun Laws
requested to merge
issue/lite-3230415:8.x-1.x
into
8.x-1.x
3 years ago
Overview
0
Commits
12
Pipelines
0
Changes
6
Expand
0
0
Merge request reports
Compare
8.x-1.x
version 6
b5b1c866
3 years ago
version 5
6ee378a2
3 years ago
version 4
e0fd75e5
3 years ago
version 3
34e51f1a
3 years ago
version 2
7113bc35
3 years ago
version 1
dd56ca69
3 years ago
8.x-1.x (HEAD)
and
latest version
latest version
c28bfd94
12 commits,
3 years ago
version 6
b5b1c866
11 commits,
3 years ago
version 5
6ee378a2
10 commits,
3 years ago
version 4
e0fd75e5
9 commits,
3 years ago
version 3
34e51f1a
8 commits,
3 years ago
version 2
7113bc35
7 commits,
3 years ago
version 1
dd56ca69
6 commits,
3 years ago
6 files
+
230
−
157
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
src/Plugin/CKEditorPlugin/Lite.php
+
48
−
10
Options
@@ -25,9 +25,7 @@ class Lite extends CKEditorPluginBase {
* {@inheritdoc}
*/
public
function
getFile
()
{
$library
=
libraries_detect
(
'lite'
);
return
$library
[
'library path'
]
.
'/plugin.js'
;
return
$this
->
getLibraryPath
()
.
'/plugin.js'
;
}
/**
@@ -48,34 +46,74 @@ class Lite extends CKEditorPluginBase {
* {@inheritdoc}
*/
public
function
getButtons
()
{
$library
=
libraries_detect
(
'lite'
);
$library
Path
=
$this
->
getLibraryPath
(
);
return
array
(
'lite-acceptall'
=>
array
(
'label'
=>
t
(
'Accept all changes'
),
'image'
=>
$library
[
'library p
ath
'
]
.
'/icons/lite-acceptall.png'
,
'image'
=>
$library
P
ath
.
'/icons/lite-acceptall.png'
,
),
'lite-rejectall'
=>
array
(
'label'
=>
t
(
'Reject all changes'
),
'image'
=>
$library
[
'library p
ath
'
]
.
'/icons/lite-rejectall.png'
,
'image'
=>
$library
P
ath
.
'/icons/lite-rejectall.png'
,
),
'lite-acceptone'
=>
array
(
'label'
=>
t
(
'Accept change'
),
'image'
=>
$library
[
'library p
ath
'
]
.
'/icons/lite-acceptone.png'
,
'image'
=>
$library
P
ath
.
'/icons/lite-acceptone.png'
,
),
'lite-rejectone'
=>
array
(
'label'
=>
t
(
'Reject change'
),
'image'
=>
$library
[
'library p
ath
'
]
.
'/icons/lite-rejectone.png'
,
'image'
=>
$library
P
ath
.
'/icons/lite-rejectone.png'
,
),
'lite-toggleshow'
=>
array
(
'label'
=>
t
(
'Show/hide tracked changes'
),
'image'
=>
$library
[
'library p
ath
'
]
.
'/icons/lite-toggleshow.png'
,
'image'
=>
$library
P
ath
.
'/icons/lite-toggleshow.png'
,
),
'lite-toggletracking'
=>
array
(
'label'
=>
t
(
'Start/stop tracking changes'
),
'image'
=>
$library
[
'library p
ath
'
]
.
'/icons/lite-toggletracking.png'
,
'image'
=>
$library
P
ath
.
'/icons/lite-toggletracking.png'
,
),
);
}
/**
* Get the CKEditor Lite library path.
*/
protected
function
getLibraryPath
()
{
// Following the logic in Drupal 8.9.x and Drupal 9.x
// ----------------------------------------------------------------------
// Issue #3096648: Add support for third party libraries in site specific
// and install profile specific libraries folders
// https://www.drupal.org/project/drupal/issues/3096648
//
// https://git.drupalcode.org/project/drupal/commit/1edf15f
// -----------------------------------------------------------------------
// Search sites/<domain>/*.
$directories
[]
=
\Drupal
::
service
(
'site.path'
)
.
"/libraries/"
;
// Always search the root 'libraries' directory.
$directories
[]
=
'libraries/'
;
// Installation profiles can place libraries into a 'libraries' directory.
if
(
$installProfile
=
\Drupal
::
installProfile
())
{
$profile_path
=
drupal_get_path
(
'profile'
,
$installProfile
);
$directories
[]
=
"
$profile_path
/libraries/"
;
}
foreach
(
$directories
as
$dir
)
{
if
(
file_exists
(
DRUPAL_ROOT
.
'/'
.
$dir
.
'lite/plugin.js'
))
{
return
$dir
.
'lite'
;
}
}
return
'libraries/lite'
;
}
/**
* Get the CKEditor Lite library URL.
*/
protected
function
getLibraryUrl
()
{
$originUrl
=
\Drupal
::
request
()
->
getSchemeAndHttpHost
()
.
\Drupal
::
request
()
->
getBaseUrl
();
return
$originUrl
.
'/'
.
$this
->
getLibraryPath
();
}
}
Loading