Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setTypeName example
$class
->
setFields
(
$fields
)
;
return
$class
;
}
public
function
createField
(
array
$field
)
: Field
{
$class
=
new
Field
(
)
;
$class
->
setName
(
$field
[
'name'
]
)
;
$class
->
setLabel
(
$field
[
'label'
]
)
;
$class
->
setTypeName
(
$field
[
'type'
]
)
;
$className
=
$this
->
getClassByAlias
(
$field
[
'type'
]
)
?:
$field
[
'type'
]
;
if
(
!\
is_string
(
$className
)
|| !
class_exists
(
$className
)
|| !
$this
->
implementsFieldInterface
(
$className
)
)
{
$className
= DummyField::
class
;
}
$class
->
setType
(
new
$className
(
)
)
;
if
(
isset
(
$field
[
'showListing'
]
)
)
{
$class
->
setShowListing
(
$field
[
'showListing'
]
)
;
}