Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
clean_node_api
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
clean_node_api
Commits
2584af45
Commit
2584af45
authored
5 years ago
by
Meysam Zandy
Browse files
Options
Downloads
Patches
Plain Diff
make functions statically.
parent
db079826
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Controller/Helper/Fields.php
+81
-81
81 additions, 81 deletions
src/Controller/Helper/Fields.php
src/Controller/Helper/MainHelper.php
+37
-37
37 additions, 37 deletions
src/Controller/Helper/MainHelper.php
src/Controller/Node.php
+3
-3
3 additions, 3 deletions
src/Controller/Node.php
with
121 additions
and
121 deletions
src/Controller/Helper/Fields.php
+
81
−
81
View file @
2584af45
...
...
@@ -36,13 +36,13 @@ class Fields {
* @return array
* Return in array
*/
public
function
booleanFields
(
string
$fieldType
,
array
$data
,
array
$values
,
string
$key
):
array
{
public
static
function
booleanFields
(
string
$fieldType
,
array
$data
,
array
$values
,
string
$key
):
array
{
$newValues
=
NULL
;
if
(
$fieldType
===
'boolean'
)
{
foreach
(
$values
as
$value
)
{
$newValues
=
[
self
::
VALUE
=>
(
bool
)
$value
];
}
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$newValues
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$newValues
);
}
// Return Data in array.
return
$data
;
...
...
@@ -82,10 +82,10 @@ class Fields {
* @return array
* Return in array
*/
public
function
changedFields
(
string
$fieldType
,
array
$data
,
array
$values
,
string
$key
):
array
{
public
static
function
changedFields
(
string
$fieldType
,
array
$data
,
array
$values
,
string
$key
):
array
{
if
(
$fieldType
===
'changed'
)
{
$data
=
$this
->
changeTypeToInt
(
$data
,
$key
,
$values
);
$data
=
self
::
changeTypeToInt
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -104,12 +104,12 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
changeTypeToInt
(
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
changeTypeToInt
(
array
$data
,
string
$key
,
array
$values
)
{
$newValues
=
NULL
;
foreach
(
$values
as
$newValue
)
{
$newValues
[]
=
[
self
::
VALUE
=>
(
int
)
$newValue
[
self
::
VALUE
]];
}
return
$this
->
getArrayPush
(
$data
,
$key
,
$newValues
);
return
self
::
getArrayPush
(
$data
,
$key
,
$newValues
);
}
/**
...
...
@@ -127,10 +127,10 @@ class Fields {
* @return array
* Return in array
*/
public
function
commentFields
(
string
$fieldType
,
array
$data
,
array
$values
,
string
$key
):
array
{
public
static
function
commentFields
(
string
$fieldType
,
array
$data
,
array
$values
,
string
$key
):
array
{
if
(
$fieldType
===
'comment'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -151,10 +151,10 @@ class Fields {
* @return array
* Return in array
*/
public
function
createdFields
(
string
$fieldType
,
array
$data
,
array
$values
,
string
$key
):
array
{
public
static
function
createdFields
(
string
$fieldType
,
array
$data
,
array
$values
,
string
$key
):
array
{
if
(
$fieldType
===
'created'
)
{
$data
=
$this
->
changeTypeToInt
(
$data
,
$key
,
$values
);
$data
=
self
::
changeTypeToInt
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -175,9 +175,9 @@ class Fields {
* @return array
* Return in array
*/
public
function
datetimeFields
(
string
$fieldType
,
array
$data
,
array
$values
,
string
$key
):
array
{
public
static
function
datetimeFields
(
string
$fieldType
,
array
$data
,
array
$values
,
string
$key
):
array
{
if
(
$fieldType
===
'datetime'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -198,9 +198,9 @@ class Fields {
* @return array
* Return in array
*/
public
function
daterangeFields
(
string
$fieldType
,
array
$data
,
array
$values
,
string
$key
):
array
{
public
static
function
daterangeFields
(
string
$fieldType
,
array
$data
,
array
$values
,
string
$key
):
array
{
if
(
$fieldType
===
'daterange'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -221,9 +221,9 @@ class Fields {
* @return array
* Return in array
*/
public
function
decimalFields
(
string
$fieldType
,
array
$data
,
array
$values
,
string
$key
):
array
{
public
static
function
decimalFields
(
string
$fieldType
,
array
$data
,
array
$values
,
string
$key
):
array
{
if
(
$fieldType
===
'decimal'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -244,9 +244,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
emailFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
emailFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'email'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -269,13 +269,13 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
entityReferenceFields
(
$node
,
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
entityReferenceFields
(
$node
,
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
$entityData
=
NULL
;
if
(
$fieldType
===
'entity_reference'
)
{
$entityData
=
$this
->
referenceControl
(
$node
,
$key
,
$values
,
$entityData
);
$entityData
=
self
::
referenceControl
(
$node
,
$key
,
$values
,
$entityData
);
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$entityData
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$entityData
);
}
// Return Data in array.
return
$data
;
...
...
@@ -296,7 +296,7 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
fileFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
fileFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
$entityData
=
NULL
;
if
(
$fieldType
===
'file'
)
{
foreach
(
$values
as
$id
)
{
...
...
@@ -310,7 +310,7 @@ class Fields {
}
}
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$entityData
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$entityData
);
}
// Return Data in array.
return
$data
;
...
...
@@ -331,9 +331,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
floatFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
floatFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'float'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -354,7 +354,7 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
imageFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
imageFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
$entityData
=
NULL
;
if
(
$fieldType
===
'image'
)
{
foreach
(
$values
as
$id
)
{
...
...
@@ -371,7 +371,7 @@ class Fields {
];
}
}
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$entityData
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$entityData
);
}
// Return Data in array.
return
$data
;
...
...
@@ -392,10 +392,10 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
integerFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
integerFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'integer'
)
{
$data
=
$this
->
changeTypeToInt
(
$data
,
$key
,
$values
);
$data
=
self
::
changeTypeToInt
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -416,9 +416,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
languageFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
languageFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'language'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -439,9 +439,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
linkFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
linkFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'link'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -462,10 +462,10 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
listFloatFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
listFloatFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'list_float'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -486,9 +486,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
listIntegerFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
listIntegerFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'list_integer'
)
{
$data
=
$this
->
changeTypeToInt
(
$data
,
$key
,
$values
);
$data
=
self
::
changeTypeToInt
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -509,9 +509,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
listStringFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
listStringFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'list_string'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -532,9 +532,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
mapFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
mapFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'map'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -555,9 +555,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
passwordFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
passwordFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'password'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -578,9 +578,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
pathFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
pathFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'path'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -601,9 +601,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
stringFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
stringFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'string'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -624,9 +624,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
stringLongFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
stringLongFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'string_long'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -647,9 +647,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
telephoneFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
telephoneFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'telephone'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -670,9 +670,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
textFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
textFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'text'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -693,9 +693,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
textLongFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
textLongFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'text_long'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -716,9 +716,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
textWithSummaryFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
textWithSummaryFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'text_with_summary'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -739,9 +739,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
timestampFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
timestampFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'timestamp'
)
{
$data
=
$this
->
changeTypeToInt
(
$data
,
$key
,
$values
);
$data
=
self
::
changeTypeToInt
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -762,9 +762,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
uriFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
uriFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'uri'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -785,9 +785,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
uuidFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
uuidFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'uuid'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -808,9 +808,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
dynamicEntityReferenceFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
dynamicEntityReferenceFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'dynamic_entity_reference'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -833,7 +833,7 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
entityReferenceRevisionsFields
(
$node
,
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
entityReferenceRevisionsFields
(
$node
,
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
$entity
=
NULL
;
$entityData
=
NULL
;
if
(
$fieldType
===
'entity_reference_revisions'
)
{
...
...
@@ -846,12 +846,12 @@ class Fields {
if
(
$entity
)
{
$entityData
[]
=
[
'pid'
=>
(
int
)
$entity
->
id
(),
'pData'
=>
$this
->
rebuildFields
(
$entity
),
'pData'
=>
MainHelper
::
rebuildFields
(
$entity
),
];
}
}
}
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$entityData
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$entityData
);
}
// Return Data in array.
return
$data
;
...
...
@@ -872,9 +872,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
videoFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
videoFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'video'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -895,9 +895,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
jqueryColorPickerFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
jqueryColorPickerFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'jquery_colorpicker'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -918,9 +918,9 @@ class Fields {
* @return mixed
* Return in mixed .
*/
public
function
metatagFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
public
static
function
metatagFields
(
string
$fieldType
,
array
$data
,
string
$key
,
array
$values
)
{
if
(
$fieldType
===
'metatag'
)
{
$data
=
$this
->
getArrayPush
(
$data
,
$key
,
$values
);
$data
=
self
::
getArrayPush
(
$data
,
$key
,
$values
);
}
// Return Data in array.
return
$data
;
...
...
@@ -941,22 +941,22 @@ class Fields {
* @return array|null
* Return array|null
*/
public
function
referenceControl
(
$node
,
string
$key
,
array
$values
,
?array
$entityData
)
{
public
static
function
referenceControl
(
$node
,
string
$key
,
array
$values
,
?array
$entityData
)
{
$entityType
=
$node
->
get
(
$key
)
->
getFieldDefinition
()
->
getSettings
()[
'target_type'
];
if
(
$entityType
===
'user'
)
{
$entityData
=
$this
->
renderUserReference
(
$values
,
$entityData
);
$entityData
=
self
::
renderUserReference
(
$values
,
$entityData
);
}
elseif
(
$entityType
===
'taxonomy_term'
)
{
$entityData
=
$this
->
renderTaxonomyTermReference
(
$values
,
$entityData
);
$entityData
=
self
::
renderTaxonomyTermReference
(
$values
,
$entityData
);
}
elseif
(
$entityType
===
'node'
)
{
$entityData
=
$this
->
renderNodeReference
(
$values
,
$entityData
);
$entityData
=
self
::
renderNodeReference
(
$values
,
$entityData
);
}
else
{
...
...
@@ -980,7 +980,7 @@ class Fields {
* @return array|null
* Return array|null
*/
public
function
renderUserReference
(
array
$values
,
?array
$entityData
)
{
public
static
function
renderUserReference
(
array
$values
,
?array
$entityData
)
{
foreach
(
$values
as
$id
)
{
$entity
=
User
::
load
(
$id
[
self
::
TARGET_ID
]);
if
(
$entity
)
{
...
...
@@ -1006,7 +1006,7 @@ class Fields {
* @return array|null
* Return array|null
*/
public
function
renderTaxonomyTermReference
(
array
$values
,
?array
$entityData
)
{
public
static
function
renderTaxonomyTermReference
(
array
$values
,
?array
$entityData
)
{
foreach
(
$values
as
$id
)
{
$entity
=
Term
::
load
(
$id
[
self
::
TARGET_ID
]);
if
(
$entity
)
{
...
...
@@ -1031,7 +1031,7 @@ class Fields {
* @return array|null
* Return array|null
*/
public
function
renderNodeReference
(
array
$values
,
?array
$entityData
)
{
public
static
function
renderNodeReference
(
array
$values
,
?array
$entityData
)
{
foreach
(
$values
as
$id
)
{
$entity
=
Node
::
load
(
$id
[
self
::
TARGET_ID
]);
if
(
$entity
)
{
...
...
This diff is collapsed.
Click to expand it.
src/Controller/Helper/MainHelper.php
+
37
−
37
View file @
2584af45
...
...
@@ -7,7 +7,7 @@ use Symfony\Component\HttpFoundation\JsonResponse;
/**
* MainHelper for Node class .
*/
class
MainHelper
extends
Fields
{
class
MainHelper
{
/**
* Params Description .
...
...
@@ -45,82 +45,82 @@ class MainHelper extends Fields {
* @return array
* Return data in array .
*/
public
function
rebuildFields
(
$node
):
array
{
public
static
function
rebuildFields
(
$node
):
array
{
$data
=
[];
$array
=
$node
->
toArray
();
foreach
(
$array
as
$key
=>
$values
)
{
$fieldType
=
$node
->
get
(
$key
)
->
getFieldDefinition
()
->
getType
();
$data
=
$this
->
booleanFields
(
$fieldType
,
$data
,
$values
,
$key
);
$data
=
Fields
::
booleanFields
(
$fieldType
,
$data
,
$values
,
$key
);
$data
=
$this
->
changedFields
(
$fieldType
,
$data
,
$values
,
$key
);
$data
=
Fields
::
changedFields
(
$fieldType
,
$data
,
$values
,
$key
);
$data
=
$this
->
commentFields
(
$fieldType
,
$data
,
$values
,
$key
);
$data
=
Fields
::
commentFields
(
$fieldType
,
$data
,
$values
,
$key
);
$data
=
$this
->
createdFields
(
$fieldType
,
$data
,
$values
,
$key
);
$data
=
Fields
::
createdFields
(
$fieldType
,
$data
,
$values
,
$key
);
$data
=
$this
->
datetimeFields
(
$fieldType
,
$data
,
$values
,
$key
);
$data
=
Fields
::
datetimeFields
(
$fieldType
,
$data
,
$values
,
$key
);
$data
=
$this
->
daterangeFields
(
$fieldType
,
$data
,
$values
,
$key
);
$data
=
Fields
::
daterangeFields
(
$fieldType
,
$data
,
$values
,
$key
);
$data
=
$this
->
decimalFields
(
$fieldType
,
$data
,
$values
,
$key
);
$data
=
Fields
::
decimalFields
(
$fieldType
,
$data
,
$values
,
$key
);
$data
=
$this
->
emailFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
emailFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
entityReferenceFields
(
$node
,
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
entityReferenceFields
(
$node
,
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
fileFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
fileFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
floatFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
floatFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
imageFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
imageFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
integerFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
integerFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
languageFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
languageFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
linkFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
linkFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
listFloatFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
listFloatFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
listIntegerFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
listIntegerFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
listStringFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
listStringFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
mapFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
mapFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
passwordFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
passwordFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
pathFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
pathFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
stringFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
stringFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
stringLongFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
stringLongFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
telephoneFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
telephoneFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
textFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
textFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
textLongFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
textLongFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
textWithSummaryFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
textWithSummaryFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
timestampFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
timestampFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
uriFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
uriFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
uuidFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
uuidFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
dynamicEntityReferenceFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
dynamicEntityReferenceFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
entityReferenceRevisionsFields
(
$node
,
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
entityReferenceRevisionsFields
(
$node
,
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
videoFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
videoFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
jqueryColorPickerFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
jqueryColorPickerFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
$this
->
metatagFields
(
$fieldType
,
$data
,
$key
,
$values
);
$data
=
Fields
::
metatagFields
(
$fieldType
,
$data
,
$key
,
$values
);
}
...
...
This diff is collapsed.
Click to expand it.
src/Controller/Node.php
+
3
−
3
View file @
2584af45
...
...
@@ -9,7 +9,7 @@ use Symfony\Component\HttpFoundation\JsonResponse;
/**
* Returns responses for nodes .
*/
class
Node
extends
MainHelper
{
class
Node
{
/**
* Define body .
...
...
@@ -52,11 +52,11 @@ class Node extends MainHelper {
if
(
$node
)
{
$this
->
body
=
$this
->
rebuildFields
(
$node
);
$this
->
body
=
MainHelper
::
rebuildFields
(
$node
);
}
return
$this
->
returnDataInJson
(
$this
->
body
,
$this
->
message
,
$this
->
statusCode
,
$this
->
statusMessage
);
return
MainHelper
::
returnDataInJson
(
$this
->
body
,
$this
->
message
,
$this
->
statusCode
,
$this
->
statusMessage
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment