-
Notifications
You must be signed in to change notification settings - Fork 2
[SW-827] Added alter hook for cardLinkEnhancer to handle the url belongs to other sites. #82
Conversation
…ngs to other sites.
* | ||
* @see Drupal\tide_landing_page\Plugin\jsonapi\FieldEnhancer\CardLinkEnhancer::doUndoTransform() | ||
*/ | ||
function tide_site_tide_card_link_enhancer_undo_transform_alter(&$data, &$context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @MdNadimHossain , I think you have to define your own alter API first, otherwise it wouldn't work, an example can be found here https://github.com/dpc-sdp/tide_core/blob/develop/modules/tide_workflow_notification/tide_workflow_notification.api.php.
correct me if I am wrong @GROwen .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant a tide_site.api.php
or you can use drupal/symfony event system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @vincent-gao actually it worked. These are the PR environments -
BE - https://nginx-php.pr-1056.content-vic.sdp1.sdp.vic.gov.au
FE - https://app.pr-838.vic-gov-au.sdp1.sdp.vic.gov.au
@MdNadimHossain , just one question, where did you define it says |
Hey @vincent-gao , here - https://github.com/dpc-sdp/tide_landing_page/blob/80911c88485b21796c80eee6c8dd51016720095e/src/Plugin/jsonapi/FieldEnhancer/CardLinkEnhancer.php#L43 |
Hi @MdNadimHossain , I think you might want to explicitly define a hook by create a |
@vincent-gao good point, I will add it in the tide_landing_page module as this hook belongs to the landing page module. |
@vincent-gao I have added the hook info in tide_landing_page api here - dpc-sdp/tide_landing_page#135 |
Jira
https://digital-engagement.atlassian.net/browse/SW-827
Issue
For the card consolidation story, a new enhancer is added named cardLinkEnhancer. When an internal link is added to the card link field and the added links belong to another site, the FE throws an error on trying to access that link. There is a alter hook for tide_path_enhancer
tide_site_tide_path_enhancer_undo_transform_alter
that resolves this and the same functionality is need for the cardLinkEnhancer alter hook.Changes
Related PRs -
dpc-sdp/tide_landing_page#131
Future work
A ticket is created to build a helper function which will be called in both of the alter hook for path enhancer and cardLinkEnhancer as they both are doing the same functionalities. It needs a solution direction and broader test case as the path enhancer is is used widely in all projects.
Ticket - https://digital-engagement.atlassian.net/browse/SDPA-5062
Testing PR- #83