Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
e-epal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Σταύρος Παπαδάκης
e-epal
Commits
619f511c
Commit
619f511c
authored
Apr 12, 2017
by
Νίκος Κατσαούνος
Browse files
Options
Browse Files
Download
Plain Diff
Several updates
parents
7d17f7d3
4983bc5d
Changes
52
Hide whitespace changes
Inline
Side-by-side
Showing
52 changed files
with
2739 additions
and
177 deletions
+2739
-177
.gitignore
.gitignore
+1
-0
drupal/modules/casost/casost.info.yml
drupal/modules/casost/casost.info.yml
+5
-0
drupal/modules/casost/casost.links.action.yml
drupal/modules/casost/casost.links.action.yml
+10
-0
drupal/modules/casost/casost.links.menu.yml
drupal/modules/casost/casost.links.menu.yml
+28
-0
drupal/modules/casost/casost.links.task.yml
drupal/modules/casost/casost.links.task.yml
+43
-0
drupal/modules/casost/casost.module
drupal/modules/casost/casost.module
+36
-0
drupal/modules/casost/casost.permissions.yml
drupal/modules/casost/casost.permissions.yml
+44
-0
drupal/modules/casost/casost.routing.yml
drupal/modules/casost/casost.routing.yml
+14
-0
drupal/modules/casost/casost.services.yml
drupal/modules/casost/casost.services.yml
+4
-0
drupal/modules/casost/casost_config.page.inc
drupal/modules/casost/casost_config.page.inc
+30
-0
drupal/modules/casost/casost_session.page.inc
drupal/modules/casost/casost_session.page.inc
+30
-0
drupal/modules/casost/composer.json
drupal/modules/casost/composer.json
+14
-0
drupal/modules/casost/config/install/casost.settings.yml
drupal/modules/casost/config/install/casost.settings.yml
+0
-0
drupal/modules/casost/config/install/casost.settingsold.yml
drupal/modules/casost/config/install/casost.settingsold.yml
+0
-0
drupal/modules/casost/src/CASOSTConfigAccessControlHandler.php
...l/modules/casost/src/CASOSTConfigAccessControlHandler.php
+47
-0
drupal/modules/casost/src/CASOSTConfigHtmlRouteProvider.php
drupal/modules/casost/src/CASOSTConfigHtmlRouteProvider.php
+85
-0
drupal/modules/casost/src/CASOSTConfigListBuilder.php
drupal/modules/casost/src/CASOSTConfigListBuilder.php
+45
-0
drupal/modules/casost/src/CASOSTSessionAccessControlHandler.php
.../modules/casost/src/CASOSTSessionAccessControlHandler.php
+47
-0
drupal/modules/casost/src/CASOSTSessionHtmlRouteProvider.php
drupal/modules/casost/src/CASOSTSessionHtmlRouteProvider.php
+85
-0
drupal/modules/casost/src/CASOSTSessionListBuilder.php
drupal/modules/casost/src/CASOSTSessionListBuilder.php
+45
-0
drupal/modules/casost/src/Controller/CASLogin.php
drupal/modules/casost/src/Controller/CASLogin.php
+254
-0
drupal/modules/casost/src/Controller/CASLogout.php
drupal/modules/casost/src/Controller/CASLogout.php
+139
-0
drupal/modules/casost/src/Entity/CASOSTConfig.php
drupal/modules/casost/src/Entity/CASOSTConfig.php
+469
-0
drupal/modules/casost/src/Entity/CASOSTConfigInterface.php
drupal/modules/casost/src/Entity/CASOSTConfigInterface.php
+77
-0
drupal/modules/casost/src/Entity/CASOSTConfigViewsData.php
drupal/modules/casost/src/Entity/CASOSTConfigViewsData.php
+24
-0
drupal/modules/casost/src/Entity/CASOSTSession.php
drupal/modules/casost/src/Entity/CASOSTSession.php
+252
-0
drupal/modules/casost/src/Entity/CASOSTSessionInterface.php
drupal/modules/casost/src/Entity/CASOSTSessionInterface.php
+77
-0
drupal/modules/casost/src/Entity/CASOSTSessionViewsData.php
drupal/modules/casost/src/Entity/CASOSTSessionViewsData.php
+24
-0
drupal/modules/casost/src/Form/CASOSTConfigDeleteForm.php
drupal/modules/casost/src/Form/CASOSTConfigDeleteForm.php
+15
-0
drupal/modules/casost/src/Form/CASOSTConfigForm.php
drupal/modules/casost/src/Form/CASOSTConfigForm.php
+50
-0
drupal/modules/casost/src/Form/CASOSTConfigSettingsForm.php
drupal/modules/casost/src/Form/CASOSTConfigSettingsForm.php
+55
-0
drupal/modules/casost/src/Form/CASOSTSessionDeleteForm.php
drupal/modules/casost/src/Form/CASOSTSessionDeleteForm.php
+15
-0
drupal/modules/casost/src/Form/CASOSTSessionForm.php
drupal/modules/casost/src/Form/CASOSTSessionForm.php
+50
-0
drupal/modules/casost/src/Form/CASOSTSessionSettingsForm.php
drupal/modules/casost/src/Form/CASOSTSessionSettingsForm.php
+55
-0
drupal/modules/casost/src/Tests/LoadTest.php
drupal/modules/casost/src/Tests/LoadTest.php
+46
-0
drupal/modules/casost/templates/oauthost.html.twig
drupal/modules/casost/templates/oauthost.html.twig
+1
-0
drupal/modules/casost/templates/oauthost_config.html.twig
drupal/modules/casost/templates/oauthost_config.html.twig
+22
-0
drupal/modules/casost/templates/oauthost_session.html.twig
drupal/modules/casost/templates/oauthost_session.html.twig
+22
-0
drupal/modules/epal/src/Controller/CurrentUser.php
drupal/modules/epal/src/Controller/CurrentUser.php
+21
-0
drupal/modules/epal/src/Controller/DirectorView.php
drupal/modules/epal/src/Controller/DirectorView.php
+119
-66
drupal/modules/epaldeploysystem/config/optional/user.role.epal.yml
...dules/epaldeploysystem/config/optional/user.role.epal.yml
+45
-0
drupal/modules/oauthost/src/Controller/OAuthLogin.php
drupal/modules/oauthost/src/Controller/OAuthLogin.php
+2
-0
drupal/modules/oauthost/src/Controller/OAuthLogout.php
drupal/modules/oauthost/src/Controller/OAuthLogout.php
+5
-1
source/app.settings.ts
source/app.settings.ts
+2
-2
source/components/director/director-view.ts
source/components/director/director-view.ts
+25
-26
source/components/home.ts
source/components/home.ts
+1
-1
source/components/navbar/navbar.component.html
source/components/navbar/navbar.component.html
+8
-17
source/components/navbar/navbar.component.ts
source/components/navbar/navbar.component.ts
+26
-8
source/components/school.home.ts
source/components/school.home.ts
+91
-0
source/containers/main.routes.ts
source/containers/main.routes.ts
+3
-0
source/containers/main.ts
source/containers/main.ts
+2
-0
source/services/helper-data-service.ts
source/services/helper-data-service.ts
+129
-56
No files found.
.gitignore
View file @
619f511c
...
@@ -8,6 +8,7 @@ drupal/modules/*
...
@@ -8,6 +8,7 @@ drupal/modules/*
!drupal/modules/epal/
!drupal/modules/epal/
!drupal/modules/epalreadydata/
!drupal/modules/epalreadydata/
!drupal/modules/oauthost/
!drupal/modules/oauthost/
!drupal/modules/casost/
!drupal/modules/epaldeploysystem/
!drupal/modules/epaldeploysystem/
# Logs
# Logs
...
...
drupal/modules/casost/casost.info.yml
0 → 100644
View file @
619f511c
name
:
casost
type
:
module
description
:
Authentication Provider OST
core
:
8.x
package
:
casost
drupal/modules/casost/casost.links.action.yml
0 → 100644
View file @
619f511c
entity.casost_config.add_form
:
route_name
:
entity.casost_config.add_form
title
:
'
Add
CASOST
Config'
appears_on
:
-
entity.casost_config.collection
entity.casost_session.add_form
:
route_name
:
entity.casost_session.add_form
title
:
'
Add
CASOST
Session'
appears_on
:
-
entity.casost_session.collection
drupal/modules/casost/casost.links.menu.yml
0 → 100644
View file @
619f511c
# CASOST Config menu items definition
entity.casost_config.collection
:
title
:
'
CASOST
Config
list'
route_name
:
entity.casost_config.collection
description
:
'
List
CASOST
Config
entities'
parent
:
system.admin_structure
weight
:
100
casost_config.admin.structure.settings
:
title
:
CASOST Config settings
description
:
'
Configure
CASOST
Config
entities'
route_name
:
casost_config.settings
parent
:
system.admin_structure
# CASOST Session menu items definition
entity.casost_session.collection
:
title
:
'
CASOST
Session
list'
route_name
:
entity.casost_session.collection
description
:
'
List
CASOST
Session
entities'
parent
:
system.admin_structure
weight
:
100
casost_session.admin.structure.settings
:
title
:
CASOST Session settings
description
:
'
Configure
CASOST
Session
entities'
route_name
:
casost_session.settings
parent
:
system.admin_structure
drupal/modules/casost/casost.links.task.yml
0 → 100644
View file @
619f511c
# CASOST Config routing definition
casost_config.settings_tab
:
route_name
:
casost_config.settings
title
:
'
Settings'
base_route
:
casost_config.settings
entity.casost_config.canonical
:
route_name
:
entity.casost_config.canonical
base_route
:
entity.casost_config.canonical
title
:
'
View'
entity.casost_config.edit_form
:
route_name
:
entity.casost_config.edit_form
base_route
:
entity.casost_config.canonical
title
:
'
Edit'
entity.casost_config.delete_form
:
route_name
:
entity.casost_config.delete_form
base_route
:
entity.casost_config.canonical
title
:
Delete
weight
:
10
# CASOST Session routing definition
casost_session.settings_tab
:
route_name
:
casost_session.settings
title
:
'
Settings'
base_route
:
casost_session.settings
entity.casost_session.canonical
:
route_name
:
entity.casost_session.canonical
base_route
:
entity.casost_session.canonical
title
:
'
View'
entity.casost_session.edit_form
:
route_name
:
entity.casost_session.edit_form
base_route
:
entity.casost_session.canonical
title
:
'
Edit'
entity.casost_session.delete_form
:
route_name
:
entity.casost_session.delete_form
base_route
:
entity.casost_session.canonical
title
:
Delete
weight
:
10
drupal/modules/casost/casost.module
0 → 100644
View file @
619f511c
<?php
/**
* @file
* Contains casost.module.
*/
use
Drupal\Core\Routing\RouteMatchInterface
;
/**
* Implements hook_help().
*/
function
casost_help
(
$route_name
,
RouteMatchInterface
$route_match
)
{
switch
(
$route_name
)
{
// Main module help for the casost module.
case
'help.page.casost'
:
$output
=
''
;
$output
.
=
'<h3>'
.
t
(
'About'
)
.
'</h3>'
;
$output
.
=
'<p>'
.
t
(
'Authentication Provider OST'
)
.
'</p>'
;
return
$output
;
default
:
}
}
/**
* Implements hook_theme().
*/
function
casost_theme
()
{
return
[
'casost'
=>
[
'template'
=>
'casost'
,
'render element'
=>
'children'
,
],
];
}
drupal/modules/casost/casost.permissions.yml
0 → 100644
View file @
619f511c
add casost config entities
:
title
:
'
Create
new
CASOST
Config
entities'
administer casost config entities
:
title
:
'
Administer
CASOST
Config
entities'
description
:
'
Allow
to
access
the
administration
form
to
configure
CASOST
Config
entities.'
restrict access
:
true
delete casost config entities
:
title
:
'
Delete
CASOST
Config
entities'
edit casost config entities
:
title
:
'
Edit
CASOST
Config
entities'
access casost config overview
:
title
:
'
Access
the
CASOST
Config
overview
page'
view published casost config entities
:
title
:
'
View
published
CASOST
Config
entities'
view unpublished casost config entities
:
title
:
'
View
unpublished
CASOST
Config
entities'
add casost session entities
:
title
:
'
Create
new
CASOST
Session
entities'
administer casost session entities
:
title
:
'
Administer
CASOST
Session
entities'
description
:
'
Allow
to
access
the
administration
form
to
configure
CASOST
Session
entities.'
restrict access
:
true
delete casost session entities
:
title
:
'
Delete
CASOST
Session
entities'
edit casost session entities
:
title
:
'
Edit
CASOST
Session
entities'
access casost session overview
:
title
:
'
Access
the
CASOST
Session
overview
page'
view published casost session entities
:
title
:
'
View
published
CASOST
Session
entities'
view unpublished casost session entities
:
title
:
'
View
unpublished
CASOST
Session
entities'
drupal/modules/casost/casost.routing.yml
0 → 100644
View file @
619f511c
casost.log_in_go
:
path
:
/cas/login
defaults
:
_controller
:
'
\Drupal\casost\Controller\CASLogin::loginGo'
requirements
:
_access
:
'
TRUE'
casost.log_out_go
:
path
:
/cas/logout
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\casost\Controller\CASLogout::logoutGo'
requirements
:
_user_is_logged_in
:
'
TRUE'
drupal/modules/casost/casost.services.yml
0 → 100644
View file @
619f511c
services
:
logger.channel.cas
:
parent
:
'
logger.channel_base'
arguments
:
[
'
epal'
]
drupal/modules/casost/casost_config.page.inc
0 → 100644
View file @
619f511c
<?php
/**
* @file
* Contains casost_config.page.inc.
*
* Page callback for CASOST Config entities.
*/
use
Drupal\Core\Render\Element
;
/**
* Prepares variables for CASOST Config templates.
*
* Default template: casost_config.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the user information and any
* - attributes: HTML attributes for the containing element.
*/
function
template_preprocess_casost_config
(
array
&
$variables
)
{
// Fetch CASOSTConfig Entity Object.
$casost_config
=
$variables
[
'elements'
][
'#casost_config'
];
// Helpful $content variable for templates.
foreach
(
Element
::
children
(
$variables
[
'elements'
])
as
$key
)
{
$variables
[
'content'
][
$key
]
=
$variables
[
'elements'
][
$key
];
}
}
drupal/modules/casost/casost_session.page.inc
0 → 100644
View file @
619f511c
<?php
/**
* @file
* Contains casost_session.page.inc.
*
* Page callback for CASOST Session entities.
*/
use
Drupal\Core\Render\Element
;
/**
* Prepares variables for CASOST Session templates.
*
* Default template: casost_session.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the user information and any
* - attributes: HTML attributes for the containing element.
*/
function
template_preprocess_casost_session
(
array
&
$variables
)
{
// Fetch CASOSTSession Entity Object.
$casost_session
=
$variables
[
'elements'
][
'#casost_session'
];
// Helpful $content variable for templates.
foreach
(
Element
::
children
(
$variables
[
'elements'
])
as
$key
)
{
$variables
[
'content'
][
$key
]
=
$variables
[
'elements'
][
$key
];
}
}
drupal/modules/casost/composer.json
0 → 100644
View file @
619f511c
{
"name"
:
"drupal/casost"
,
"type"
:
"drupal-module"
,
"description"
:
"Authentication Provider OST"
,
"keywords"
:
[
"Drupal"
],
"license"
:
"GPL-2.0+"
,
"homepage"
:
"https://www.drupal.org/project/casost"
,
"minimum-stability"
:
"dev"
,
"support"
:
{
"issues"
:
"https://www.drupal.org/project/issues/casost"
,
"source"
:
"http://cgit.drupalcode.org/casost"
},
"require"
:
{
}
}
drupal/modules/casost/config/install/casost.settings.yml
0 → 100644
View file @
619f511c
drupal/modules/casost/config/install/casost.settingsold.yml
0 → 100644
View file @
619f511c
drupal/modules/casost/src/CASOSTConfigAccessControlHandler.php
0 → 100644
View file @
619f511c
<?php
namespace
Drupal\casost
;
use
Drupal\Core\Entity\EntityAccessControlHandler
;
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\Core\Session\AccountInterface
;
use
Drupal\Core\Access\AccessResult
;
/**
* Access controller for the CASOST Config entity.
*
* @see \Drupal\casost\Entity\CASOSTConfig.
*/
class
CASOSTConfigAccessControlHandler
extends
EntityAccessControlHandler
{
/**
* {@inheritdoc}
*/
protected
function
checkAccess
(
EntityInterface
$entity
,
$operation
,
AccountInterface
$account
)
{
/** @var \Drupal\casost\Entity\CASOSTConfigInterface $entity */
switch
(
$operation
)
{
case
'view'
:
if
(
!
$entity
->
isPublished
())
{
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'view unpublished casost config entities'
);
}
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'view published casost config entities'
);
case
'update'
:
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'edit casost config entities'
);
case
'delete'
:
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'delete casost config entities'
);
}
// Unknown operation, no opinion.
return
AccessResult
::
neutral
();
}
/**
* {@inheritdoc}
*/
protected
function
checkCreateAccess
(
AccountInterface
$account
,
array
$context
,
$entity_bundle
=
NULL
)
{
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'add casost config entities'
);
}
}
drupal/modules/casost/src/CASOSTConfigHtmlRouteProvider.php
0 → 100644
View file @
619f511c
<?php
namespace
Drupal\casost
;
use
Drupal\Core\Entity\EntityTypeInterface
;
use
Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
;
use
Symfony\Component\Routing\Route
;
/**
* Provides routes for CASOST Config entities.
*
* @see Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
* @see Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider
*/
class
CASOSTConfigHtmlRouteProvider
extends
AdminHtmlRouteProvider
{
/**
* {@inheritdoc}
*/
public
function
getRoutes
(
EntityTypeInterface
$entity_type
)
{
$collection
=
parent
::
getRoutes
(
$entity_type
);
$entity_type_id
=
$entity_type
->
id
();
if
(
$collection_route
=
$this
->
getCollectionRoute
(
$entity_type
))
{
$collection
->
add
(
"entity.
{
$entity_type_id
}
.collection"
,
$collection_route
);
}
if
(
$settings_form_route
=
$this
->
getSettingsFormRoute
(
$entity_type
))
{
$collection
->
add
(
"
$entity_type_id
.settings"
,
$settings_form_route
);
}
return
$collection
;
}
/**
* Gets the collection route.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route|null
* The generated route, if available.
*/
protected
function
getCollectionRoute
(
EntityTypeInterface
$entity_type
)
{
if
(
$entity_type
->
hasLinkTemplate
(
'collection'
)
&&
$entity_type
->
hasListBuilderClass
())
{
$entity_type_id
=
$entity_type
->
id
();
$route
=
new
Route
(
$entity_type
->
getLinkTemplate
(
'collection'
));
$route
->
setDefaults
([
'_entity_list'
=>
$entity_type_id
,
'_title'
=>
"
{
$entity_type
->
getLabel
()
}
list"
,
])
->
setRequirement
(
'_permission'
,
'access casost config overview'
)
->
setOption
(
'_admin_route'
,
TRUE
);
return
$route
;
}
}
/**
* Gets the settings form route.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route|null
* The generated route, if available.
*/
protected
function
getSettingsFormRoute
(
EntityTypeInterface
$entity_type
)
{
if
(
!
$entity_type
->
getBundleEntityType
())
{
$route
=
new
Route
(
"/admin/structure/
{
$entity_type
->
id
()
}
/settings"
);
$route
->
setDefaults
([
'_form'
=>
'Drupal\casost\Form\CASOSTConfigSettingsForm'
,
'_title'
=>
"
{
$entity_type
->
getLabel
()
}
settings"
,
])
->
setRequirement
(
'_permission'
,
$entity_type
->
getAdminPermission
())
->
setOption
(
'_admin_route'
,
TRUE
);
return
$route
;
}
}
}
drupal/modules/casost/src/CASOSTConfigListBuilder.php
0 → 100644
View file @
619f511c
<?php
namespace
Drupal\casost
;
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\Core\Entity\EntityListBuilder
;
use
Drupal\Core\Routing\LinkGeneratorTrait
;
use
Drupal\Core\Url
;
/**
* Defines a class to build a listing of CASOST Config entities.
*
* @ingroup casost
*/
class
CASOSTConfigListBuilder
extends
EntityListBuilder
{
use
LinkGeneratorTrait
;
/**
* {@inheritdoc}
*/
public
function
buildHeader
()
{
$header
[
'id'
]
=
$this
->
t
(
'CASOST Config ID'
);
$header
[
'name'
]
=
$this
->
t
(
'Name'
);
return
$header
+
parent
::
buildHeader
();
}
/**
* {@inheritdoc}
*/
public
function
buildRow
(
EntityInterface
$entity
)
{
/* @var $entity \Drupal\casost\Entity\CASOSTConfig */
$row
[
'id'
]
=
$entity
->
id
();
$row
[
'name'
]
=
$this
->
l
(
$entity
->
label
(),
new
Url
(
'entity.casost_config.edit_form'
,
array
(
'casost_config'
=>
$entity
->
id
(),
)
)
);
return
$row
+
parent
::
buildRow
(
$entity
);
}
}
drupal/modules/casost/src/CASOSTSessionAccessControlHandler.php
0 → 100644
View file @
619f511c
<?php
namespace
Drupal\casost
;
use
Drupal\Core\Entity\EntityAccessControlHandler
;
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\Core\Session\AccountInterface
;
use
Drupal\Core\Access\AccessResult
;
/**
* Access controller for the CASOST Session entity.
*
* @see \Drupal\casost\Entity\CASOSTSession.
*/
class
CASOSTSessionAccessControlHandler
extends
EntityAccessControlHandler
{
/**
* {@inheritdoc}
*/
protected
function
checkAccess
(
EntityInterface
$entity
,
$operation
,
AccountInterface
$account
)
{
/** @var \Drupal\casost\Entity\CASOSTSessionInterface $entity */
switch
(
$operation
)
{
case
'view'
:
if
(
!
$entity
->
isPublished
())
{
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'view unpublished casost session entities'
);
}
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'view published casost session entities'
);
case
'update'
:
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'edit casost session entities'
);
case
'delete'
:
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'delete casost session entities'
);
}
// Unknown operation, no opinion.
return
AccessResult
::
neutral
();
}
/**
* {@inheritdoc}
*/
protected
function
checkCreateAccess
(
AccountInterface
$account
,
array
$context
,
$entity_bundle
=
NULL
)
{
return
AccessResult
::
allowedIfHasPermission
(
$account
,
'add casost session entities'
);
}
}
drupal/modules/casost/src/CASOSTSessionHtmlRouteProvider.php
0 → 100644
View file @
619f511c
<?php
namespace
Drupal\casost
;
use
Drupal\Core\Entity\EntityTypeInterface
;
use
Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
;
use
Symfony\Component\Routing\Route
;
/**
* Provides routes for CASOST Session entities.
*
* @see Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
* @see Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider
*/
class
CASOSTSessionHtmlRouteProvider
extends
AdminHtmlRouteProvider
{
/**
* {@inheritdoc}
*/
public
function
getRoutes
(
EntityTypeInterface
$entity_type
)
{
$collection
=
parent
::
getRoutes
(
$entity_type
);
$entity_type_id
=
$entity_type
->
id
();
if
(
$collection_route
=
$this
->
getCollectionRoute
(
$entity_type
))
{
$collection
->
add
(
"entity.
{
$entity_type_id
}
.collection"
,
$collection_route
);
}
if
(
$settings_form_route
=
$this
->
getSettingsFormRoute
(
$entity_type
))
{
$collection
->
add
(
"
$entity_type_id
.settings"
,
$settings_form_route
);
}
return
$collection
;
}
/**
* Gets the collection route.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route|null
* The generated route, if available.
*/
protected
function
getCollectionRoute
(
EntityTypeInterface
$entity_type
)
{
if
(
$entity_type
->
hasLinkTemplate
(
'collection'
)
&&
$entity_type
->
hasListBuilderClass
())
{
$entity_type_id
=
$entity_type
->
id
();
$route
=
new
Route
(
$entity_type
->
getLinkTemplate
(
'collection'
));
$route
->
setDefaults
([
'_entity_list'
=>
$entity_type_id
,
'_title'
=>
"
{
$entity_type
->
getLabel
()
}
list"
,
])
->
setRequirement
(
'_permission'
,
'access casost session overview'
)
->
setOption
(
'_admin_route'
,
TRUE
);
return
$route
;
}
}
/**
* Gets the settings form route.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route|null
* The generated route, if available.
*/
protected
function
getSettingsFormRoute
(
EntityTypeInterface
$entity_type
)
{
if
(
!
$entity_type
->
getBundleEntityType
())
{
$route
=
new
Route
(
"/admin/structure/
{
$entity_type
->
id
()
}
/settings"
);
$route
->
setDefaults
([
'_form'
=>
'Drupal\casost\Form\CASOSTSessionSettingsForm'
,
'_title'
=>
"
{
$entity_type
->
getLabel
()
}
settings"
,
])
->
setRequirement
(
'_permission'
,
$entity_type
->
getAdminPermission
())
->
setOption
(
'_admin_route'
,
TRUE
);
return
$route
;
}
}
}
drupal/modules/casost/src/CASOSTSessionListBuilder.php
0 → 100644
View file @
619f511c
<?php
namespace
Drupal\casost
;
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\Core\Entity\EntityListBuilder
;
use
Drupal\Core\Routing\LinkGeneratorTrait
;
use
Drupal\Core\Url
;
/**