Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
email_contact
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
email_contact
Commits
0e15a010
Commit
0e15a010
authored
1 year ago
by
Frankie D
Committed by
Bálint Nagy
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3397818
by FrankieD3: PHP 8.2 has deprecated the creation of dynamic properties
parent
17a5b25a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Form/ContactForm.php
+16
-16
16 additions, 16 deletions
src/Form/ContactForm.php
with
16 additions
and
16 deletions
src/Form/ContactForm.php
+
16
−
16
View file @
0e15a010
...
...
@@ -20,28 +20,28 @@ class ContactForm extends FormBase {
/**
* The entity type machine name.
*
* @var string
* @var string
|null
*/
private
$entityType
;
/**
* String for the entity ID.
*
* @var string
* @var string
|null
*/
private
$entityId
;
/**
* String for the field name.
*
* @var string
* @var string
|null
*/
private
$fieldName
;
/**
* Array with the field settings.
*
* @var array
* @var array
|null
*/
private
$fieldSettings
;
...
...
@@ -49,10 +49,10 @@ class ContactForm extends FormBase {
* Contact Form constructor.
*/
public
function
__construct
(
$entityType
=
NULL
,
$entityId
=
NULL
,
$fieldName
=
NULL
,
$fieldSettings
=
NULL
)
{
$this
->
entity
_t
ype
=
$entityType
;
$this
->
entity
_i
d
=
$entityId
;
$this
->
field
_n
ame
=
$fieldName
;
$this
->
field
_s
ettings
=
$fieldSettings
;
$this
->
entity
T
ype
=
$entityType
;
$this
->
entity
I
d
=
$entityId
;
$this
->
field
N
ame
=
$fieldName
;
$this
->
field
S
ettings
=
$fieldSettings
;
}
/**
...
...
@@ -66,9 +66,9 @@ class ContactForm extends FormBase {
* {@inheritdoc}
*/
public
function
buildForm
(
array
$form
,
FormStateInterface
$form_state
)
{
// $this->entity
_i
d = $id;
// $this->entity
I
d = $id;
$user
=
\Drupal
::
currentUser
();
$emails
=
email_contact_get_emails_from_field
(
$this
->
entity
_t
ype
,
$this
->
entity
_i
d
,
$this
->
field
_n
ame
);
$emails
=
email_contact_get_emails_from_field
(
$this
->
entity
T
ype
,
$this
->
entity
I
d
,
$this
->
field
N
ame
);
$form
[
'emails'
]
=
[
'#type'
=>
'value'
,
'#value'
=>
serialize
(
$emails
),
...
...
@@ -103,7 +103,7 @@ class ContactForm extends FormBase {
'#value'
=>
$this
->
t
(
'Send e-mail'
),
];
if
(
!
empty
(
$this
->
field
_s
ettings
[
'modal'
]))
{
if
(
!
empty
(
$this
->
field
S
ettings
[
'modal'
]))
{
$form
[
'submit'
][
'#attributes'
][
'class'
][]
=
'use-ajax'
;
$form
[
'submit'
][
'#ajax'
]
=
[
'callback'
=>
[
$this
,
'ajaxSubmit'
],
...
...
@@ -115,7 +115,7 @@ class ContactForm extends FormBase {
}
if
(
!
$form_state
->
get
(
'settings'
))
{
$form_state
->
set
(
'settings'
,
$this
->
field
_s
ettings
);
$form_state
->
set
(
'settings'
,
$this
->
field
S
ettings
);
}
return
$form
;
...
...
@@ -180,21 +180,21 @@ class ContactForm extends FormBase {
* {@inheritdoc}
*/
public
function
submitForm
(
array
&
$form
,
FormStateInterface
$form_state
)
{
if
(
!
empty
(
$this
->
field
_s
ettings
[
'modal'
]))
{
if
(
!
empty
(
$this
->
field
S
ettings
[
'modal'
]))
{
return
;
}
$this
->
sendMessage
(
$form
,
$form_state
);
$redirect
=
'/'
;
if
(
!
empty
(
$this
->
field
_s
ettings
[
'redirection_to'
]))
{
switch
(
$this
->
field
_s
ettings
[
'redirection_to'
])
{
if
(
!
empty
(
$this
->
field
S
ettings
[
'redirection_to'
]))
{
switch
(
$this
->
field
S
ettings
[
'redirection_to'
])
{
case
'current'
:
$redirect
=
NULL
;
break
;
case
'custom'
:
$redirect
=
$this
->
field
_s
ettings
[
'custom_path'
];
$redirect
=
$this
->
field
S
ettings
[
'custom_path'
];
break
;
default
:
...
...
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