diff --git a/src/Plugin/jsonapi/FieldEnhancer/CardLinkEnhancer.php b/src/Plugin/jsonapi/FieldEnhancer/CardLinkEnhancer.php index 3a5c393..6375f06 100644 --- a/src/Plugin/jsonapi/FieldEnhancer/CardLinkEnhancer.php +++ b/src/Plugin/jsonapi/FieldEnhancer/CardLinkEnhancer.php @@ -30,6 +30,10 @@ protected function doUndoTransform($data, Context $context) { $nid = str_replace("entity:node/", "", $data['uri']); $node = !empty($nid) ? \Drupal::entityTypeManager()->getStorage('node')->load($nid) : ''; if ($node) { + if (!empty($node->toArray()['path'][0])) { + $data['pid'] = !empty($node->toArray()['path'][0]['pid']) ? $node->toArray()['path'][0]['pid'] : ''; + } + $data['alias'] = $this->getAlias($nid); $data['url'] = $this->getAlias($nid); $data['image'] = $this->getImage($node); $data['internal_node_fields'] = $this->getCardFields($node); @@ -70,8 +74,7 @@ public function getOutputJsonSchema() { public function getAlias($nid) { $url = ''; if (!empty($nid)) { - $aliasByPath = \Drupal::service('path.alias_manager')->getAliasByPath('/node/' . $nid); - $url = $this->getPathAliasWithoutSitePrefix(['alias' => $aliasByPath]); + $url = \Drupal::service('path.alias_manager')->getAliasByPath('/node/' . $nid); } return $url; } diff --git a/tide_landing_page.install b/tide_landing_page.install index adacb7e..eab9a0f 100644 --- a/tide_landing_page.install +++ b/tide_landing_page.install @@ -1387,7 +1387,7 @@ function tide_landing_page_update_8035(&$sandbox) { $sandbox['processed'] = 0; $sandbox['#finished'] = $count ? 0 : 1; } - $batch_size = 50; + $batch_size = 100; $paragraph_query = \Drupal::entityTypeManager() ->getStorage('paragraph') ->getQuery();