Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
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
cooperatic-mlc
kohinos
Commits
5ce64901
Commit
5ce64901
authored
Jun 30, 2020
by
Julien Jorry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Wordpress API KEY to view Global Parameter in ADMIN
parent
65d1d324
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
services.yaml
config/services.yaml
+2
-0
AppExtension.php
src/Twig/AppExtension.php
+11
-0
globalparameter_list.html.twig
templates/admin/globalparameter_list.html.twig
+11
-0
No files found.
config/services.yaml
View file @
5ce64901
...
@@ -302,6 +302,8 @@ services:
...
@@ -302,6 +302,8 @@ services:
admin.globalparameter.gerer
:
admin.globalparameter.gerer
:
class
:
App\Admin\GlobalParameterAdmin
class
:
App\Admin\GlobalParameterAdmin
arguments
:
[
~
,
App\Entity\GlobalParameter
,
~
]
arguments
:
[
~
,
App\Entity\GlobalParameter
,
~
]
calls
:
-
[
setTemplate
,
[
'
list'
,
'
admin/globalparameter_list.html.twig'
]]
tags
:
tags
:
-
name
:
sonata.admin
-
name
:
sonata.admin
manager_type
:
orm
manager_type
:
orm
...
...
src/Twig/AppExtension.php
View file @
5ce64901
...
@@ -58,6 +58,7 @@ class AppExtension extends AbstractExtension
...
@@ -58,6 +58,7 @@ class AppExtension extends AbstractExtension
new
\Twig_SimpleFunction
(
'getAllGroupes'
,
array
(
$this
,
'getAllGroupes'
)),
new
\Twig_SimpleFunction
(
'getAllGroupes'
,
array
(
$this
,
'getAllGroupes'
)),
new
\Twig_SimpleFunction
(
'getAllFlux'
,
array
(
$this
,
'getAllFlux'
)),
new
\Twig_SimpleFunction
(
'getAllFlux'
,
array
(
$this
,
'getAllFlux'
)),
new
\Twig_SimpleFunction
(
'mediaurl'
,
array
(
$this
,
'mediaurl'
)),
new
\Twig_SimpleFunction
(
'mediaurl'
,
array
(
$this
,
'mediaurl'
)),
new
\Twig_SimpleFunction
(
'getWordpressApiKey'
,
array
(
$this
,
'getWordpressApiKey'
)),
new
\Twig_SimpleFunction
(
'parameter'
,
function
(
$name
)
{
new
\Twig_SimpleFunction
(
'parameter'
,
function
(
$name
)
{
return
$this
->
container
->
getParameter
(
$name
);
return
$this
->
container
->
getParameter
(
$name
);
})
})
...
@@ -77,6 +78,16 @@ class AppExtension extends AbstractExtension
...
@@ -77,6 +78,16 @@ class AppExtension extends AbstractExtension
return
json_decode
(
$string
,
true
);
return
json_decode
(
$string
,
true
);
}
}
public
function
getWordpressApiKey
()
{
$users
=
$this
->
em
->
getRepository
(
User
::
class
)
->
findByRole
(
'ROLE_API'
);
if
(
count
(
$users
)
<=
0
)
{
// @TODO :erreur => crée un nouvel utilisateur API si non existant ?
return
''
;
}
return
$users
[
0
]
->
getApiKey
();
}
public
function
showModalGroupChoice
()
public
function
showModalGroupChoice
()
{
{
if
(
$this
->
security
->
getUser
()
!=
null
)
{
if
(
$this
->
security
->
getUser
()
!=
null
)
{
...
...
templates/admin/globalparameter_list.html.twig
0 → 100644
View file @
5ce64901
{%
extends
'@SonataAdmin/CRUD/base_list.html.twig'
%}
{%
block
list_table
%}
<div
class=
"col-xs-12 col-md-12"
style=
"margin-bottom: 20px;"
>
{%
if
KOH_USE_WORDPRESS
!=
'false'
%}
<strong>
WORDPRESS API KEY :
</strong>
:
{{
getWordpressApiKey
()
}}
{%
endif
%}
</div>
{{
parent
()
}}
{%
endblock
list_table
%}
\ No newline at end of file
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