From 80911c88485b21796c80eee6c8dd51016720095e Mon Sep 17 00:00:00 2001 From: MdNadimHossain Date: Mon, 22 Mar 2021 11:00:26 +1100 Subject: [PATCH 1/2] [SW-827] Added parent node id. --- src/Plugin/jsonapi/FieldEnhancer/CardLinkEnhancer.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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; } From 12727fc039f04eb32d151143bc8b4a1f615dc754 Mon Sep 17 00:00:00 2001 From: MdNadimHossain Date: Mon, 22 Mar 2021 17:07:04 +1100 Subject: [PATCH 2/2] [SW-827] Updated the hook batch size. --- tide_landing_page.install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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();