white-paper : track downloaded page per contact - refs #70
All checks were successful
Deploy / Deploy to Production (push) Successful in 21s
All checks were successful
Deploy / Deploy to Production (push) Successful in 21s
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
77c4a06b30
commit
0ca55bed5d
2 changed files with 18 additions and 0 deletions
|
|
@ -67,6 +67,8 @@ tabs:
|
||||||
width: 1/4
|
width: 1/4
|
||||||
role:
|
role:
|
||||||
label: Fonction
|
label: Fonction
|
||||||
|
whitePaper:
|
||||||
|
label: Livres blancs
|
||||||
downloadedAt:
|
downloadedAt:
|
||||||
label: Date
|
label: Date
|
||||||
fields:
|
fields:
|
||||||
|
|
@ -92,6 +94,11 @@ tabs:
|
||||||
type: email
|
type: email
|
||||||
translate: false
|
translate: false
|
||||||
required: true
|
required: true
|
||||||
|
whitePaper:
|
||||||
|
label: Livres blancs
|
||||||
|
type: pages
|
||||||
|
translate: false
|
||||||
|
query: site.find('livres-blancs').children
|
||||||
downloadedAt:
|
downloadedAt:
|
||||||
type: text
|
type: text
|
||||||
translate: false
|
translate: false
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,8 @@ return [
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$pageUuid = $page->uuid()->toString();
|
||||||
|
|
||||||
if ($existingIndex !== null) {
|
if ($existingIndex !== null) {
|
||||||
// Contact déjà présent — on enrichit les champs vides uniquement
|
// Contact déjà présent — on enrichit les champs vides uniquement
|
||||||
if ($company !== '' && empty($entries[$existingIndex]['company'])) {
|
if ($company !== '' && empty($entries[$existingIndex]['company'])) {
|
||||||
|
|
@ -68,6 +70,14 @@ return [
|
||||||
if ($role !== '' && empty($entries[$existingIndex]['role'])) {
|
if ($role !== '' && empty($entries[$existingIndex]['role'])) {
|
||||||
$entries[$existingIndex]['role'] = $role;
|
$entries[$existingIndex]['role'] = $role;
|
||||||
}
|
}
|
||||||
|
$whitePapers = $entries[$existingIndex]['whitepaper'] ?? [];
|
||||||
|
if (!is_array($whitePapers)) {
|
||||||
|
$whitePapers = array_filter(array_map('trim', explode(',', (string) $whitePapers)));
|
||||||
|
}
|
||||||
|
if (!in_array($pageUuid, $whitePapers, true)) {
|
||||||
|
$whitePapers[] = $pageUuid;
|
||||||
|
}
|
||||||
|
$entries[$existingIndex]['whitePaper'] = $whitePapers;
|
||||||
} else {
|
} else {
|
||||||
$entries[] = [
|
$entries[] = [
|
||||||
'firstName' => $firstName,
|
'firstName' => $firstName,
|
||||||
|
|
@ -75,6 +85,7 @@ return [
|
||||||
'email' => $email,
|
'email' => $email,
|
||||||
'company' => $company,
|
'company' => $company,
|
||||||
'role' => $role,
|
'role' => $role,
|
||||||
|
'whitePaper' => [$pageUuid],
|
||||||
'downloadedAt' => date('d/m/Y H:i'),
|
'downloadedAt' => date('d/m/Y H:i'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue