Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
Field
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Modulus
Services
Field
Commits
fe6bd425
Commit
fe6bd425
authored
Nov 14, 2022
by
Goldenscarab
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mise à jour de deprecated
parent
3c2d83bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
10 deletions
+27
-10
src/Compose/Field2Bt4.php
src/Compose/Field2Bt4.php
+19
-2
src/Compose/FieldBt4.php
src/Compose/FieldBt4.php
+8
-8
No files found.
src/Compose/Field2Bt4.php
View file @
fe6bd425
...
...
@@ -2,6 +2,7 @@
namespace
Goldenscarab\Modulus\Service\Field\Compose
;
use
ReflectionMethod
;
use
GuzzleHttp\Client
;
use
Illuminate\Support\Str
;
use
\Illuminate\Support\HtmlString
;
...
...
@@ -562,8 +563,24 @@ class Field2Bt4
$params
=
data_get
(
$source
,
'params'
,
[]);
$target
=
data_get
(
$source
,
'target'
);
$request
=
new
\Illuminate\Http\Request
(
$params
);
$response
=
App
::
call
(
$call
,
[
'request'
=>
$request
])
->
getData
();
$splited
=
explode
(
'@'
,
$call
);
$class
=
$splited
[
0
];
$method
=
$splited
[
1
];
// Constuction du controleur cible
$ctrl
=
App
::
make
(
$class
);
// Analyse de la methode appelée
$reflection
=
new
ReflectionMethod
(
$ctrl
,
$method
);
// Création de l'instance de l'attribut à passer à la methode
$attr_name
=
data_get
(
$reflection
->
getParameters
(),
0
)
->
getName
();
$attr_type
=
data_get
(
$reflection
->
getParameters
(),
0
)
->
getType
()
->
getName
();
$attr_inst
=
new
$attr_type
(
$params
);
// Appel de la méthode
$response
=
App
::
call
(
$call
,
[
$attr_name
=>
$attr_inst
])
->
getData
();
$data
=
data_get
(
$response
,
$target
);
}
...
...
src/Compose/FieldBt4.php
View file @
fe6bd425
...
...
@@ -735,7 +735,7 @@ class FieldBt4
$render
.=
vsprintf
(
$template
,
[
data_get
(
$item
,
$this
->
_options
[
'value'
]),
$attrs
,
$this
->
objectToString
(
$
this
->
_options
[
'template'
],
$text
,
$callback
,
$item
)
$this
->
objectToString
(
$
item
,
$this
->
_options
[
'template'
],
$text
,
$callback
)
]);
}
else
{
...
...
@@ -743,7 +743,7 @@ class FieldBt4
$render
.=
vsprintf
(
$template
,
[
data_get
(
$item
,
$this
->
_options
[
'value'
]),
$attrs
,
$this
->
objectToString
(
null
,
$text
,
$callback
,
$item
)
$this
->
objectToString
(
$item
,
null
,
$text
,
$callback
)
]);
}
}
...
...
@@ -877,10 +877,10 @@ class FieldBt4
if
(
is_array
(
$value
))
{
$value_
=
$this
->
objectToString
(
data_get
(
$value
,
'source'
),
data_get
(
$value
,
'template'
),
data_get
(
$value
,
'attributes'
),
data_get
(
$value
,
'callback'
),
data_get
(
$value
,
'source'
)
data_get
(
$value
,
'callback'
)
);
}
else
{
$value_
=
$value
;
...
...
@@ -938,10 +938,10 @@ class FieldBt4
foreach
(
$datas
as
$name
=>
$value
)
{
if
(
is_array
(
$value
))
{
$value_
=
$this
->
objectToString
(
data_get
(
$value
,
'source'
),
data_get
(
$value
,
'template'
),
data_get
(
$value
,
'attributes'
),
data_get
(
$value
,
'callback'
),
data_get
(
$value
,
'source'
)
data_get
(
$value
,
'callback'
)
);
}
else
{
$value_
=
$value
;
...
...
@@ -1032,12 +1032,12 @@ class FieldBt4
* Retourne le rendu d'un template avec une liste de noms de colonnes
* @param string $template Le template servant au rendu
* @param string|array $display Le ou les noms de colonnes
* @param
string
$callback Fonction à appliquer sur la résultante
* @param
function
$callback Fonction à appliquer sur la résultante
* @param Mix $item Objet source des donnés à afficher
* @param Mix $item Suppression des tags
* @return string Le rendu
*/
protected
function
objectToString
(
$
template
=
null
,
$displays
=
null
,
$callback
=
null
,
$item
,
$strip
=
false
)
protected
function
objectToString
(
$
item
,
$template
=
null
,
$displays
=
null
,
$callback
=
null
,
$strip
=
false
)
{
// Création du texte à afficher
$datas
=
[];
...
...
Sylvain CARRE
🖥
@goldenscarab
mentioned in commit
c51a98c7
·
Jan 20, 2023
mentioned in commit
c51a98c7
mentioned in commit c51a98c7105b9b69d8bd351d71089667f35a9715
Toggle commit list
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