Skip to content

Commit

Permalink
fix(LP-90): Check fields exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Polynya committed Sep 25, 2024
1 parent b645c63 commit b4e8c8d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Commands/ContentOwnership.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,17 @@ public function addServiceContactsToNodes() {
foreach ($node_storage->loadMultiple($ids) as $node) {
$content_owners = [];
// Combine content owners of both types without duplication.
foreach ($node->get('field_content_owner')->referencedEntities() as $entity) {
$content_owners[$entity->id()] = $entity;
if ($node->hasField('field_content_owner')) {
foreach ($node->get('field_content_owner')
->referencedEntities() as $entity) {
$content_owners[$entity->id()] = $entity;
}
}
foreach ($node->get('field_content_sme')->referencedEntities() as $entity) {
$content_owners[$entity->id()] = $entity;
if ($node->hasField('field_content_sme')) {
foreach ($node->get('field_content_sme')
->referencedEntities() as $entity) {
$content_owners[$entity->id()] = $entity;
}
}

$count = 0;
Expand Down

0 comments on commit b4e8c8d

Please sign in to comment.