Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M3P2 HTML Generator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
12
Issues
12
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
M3P2
M3P2 HTML Generator
Commits
0c4d8ab4
Commit
0c4d8ab4
authored
Sep 30, 2020
by
Administrator
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: review the lessons order
parent
9ff0cdbc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
m3-p2.php
user/plugins/m3-p2/m3-p2.php
+11
-7
No files found.
user/plugins/m3-p2/m3-p2.php
View file @
0c4d8ab4
...
...
@@ -10,8 +10,12 @@ use Symfony\Component\EventDispatcher\Event;
/**
* Features:
* - /sync Cheap git-sync (did not knew about it at the time)
* - /polyglot/<page-path>
* - /lessons/<lesson-slug>
*
* The way GRAV works to define new routes is to listen to the onPageNotFound event.
* This is expected to evolve as GRAV integrates more and more with Symfony components.
*
* Class M3P2Plugin
* @package Grav\Plugin
*/
...
...
@@ -218,7 +222,7 @@ class M3P2Plugin extends Plugin
$uri
=
$this
->
grav
[
'uri'
];
// var_dump($uri); // best doc ftw
if
(
"lesson"
!=
$uri
->
paths
(
0
))
{
if
(
"lesson
s
"
!=
$uri
->
paths
(
0
))
{
return
;
// perhaps not
}
...
...
@@ -260,19 +264,19 @@ class M3P2Plugin extends Plugin
$ha
=
$a
->
header
();
$hb
=
$b
->
header
();
$fdp
=
function
(
$
pp
)
use
(
$lesson_slug
)
{
return
$
pp
[
"slug"
]
==
$lesson_slug
;
$fdp
=
function
(
$
lesson
)
use
(
$lesson_slug
)
{
return
$
lesson
[
"slug"
]
==
$lesson_slug
;
};
// We're assuming the config exists (it should)
$ma
=
array_filter
(
$ha
->
lessons
,
$fdp
)[
0
];
$mb
=
array_filter
(
$hb
->
lessons
,
$fdp
)[
0
];
if
(
isset
(
$ma
[
'
level
'
]))
{
$la
=
floor
(
$ma
[
'
level
'
]);
if
(
isset
(
$ma
[
'
order
'
]))
{
$la
=
floor
(
$ma
[
'
order
'
]);
}
if
(
isset
(
$mb
[
'
level
'
]))
{
$lb
=
floor
(
$mb
[
'
level
'
]);
if
(
isset
(
$mb
[
'
order
'
]))
{
$lb
=
floor
(
$mb
[
'
order
'
]);
}
return
$la
-
$lb
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment