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
c51a98c7
Commit
c51a98c7
authored
Jan 20, 2023
by
Goldenscarab
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
fe6bd425
'
parents
3c2d83bd
fe6bd425
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 @
c51a98c7
...
...
@@ -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 @
c51a98c7
...
...
@@ -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
=
[];
...
...
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