Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
WCMS
uw_ct_profile
Commits
67496b25
Commit
67496b25
authored
Apr 07, 2021
by
Igor Biki
Committed by
Kevin Paxman
Apr 07, 2021
Browse files
Set read only when updating existing profile with link to contact.
parent
7ea65439
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
uw_ct_profile.module
uw_ct_profile.module
+2
-1
No files found.
uw_ct_profile.module
View file @
67496b25
...
...
@@ -21,7 +21,8 @@ function uw_ct_profile_form_node_uw_ct_profile_form_alter(&$form, FormStateInter
// Apply readonly to fields only when link with contact field has contact
// entity referenced.
if
(
!
empty
(
$form_state
->
getValue
(
'field_uw_ct_profile_contact'
)[
0
][
'target_id'
]))
{
if
(
!
empty
(
$form_state
->
getValue
(
'field_uw_ct_profile_contact'
)[
0
][
'target_id'
])
||
!
empty
(
$form
[
'field_uw_ct_profile_contact'
][
'widget'
][
0
][
'target_id'
][
'#default_value'
]))
{
foreach
(
_uw_ct_profile_alter_fields
()
as
$profile_field
=>
$contact_field
)
{
$form
[
$profile_field
][
'widget'
][
0
][
'value'
][
'#attributes'
][
'readonly'
]
=
'readonly'
;
}
...
...
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