How to get notification field data to paragraph template?

Created on 4 December 2023, 7 months ago

Problem/Motivation

Being tasked to send analytics when notification bar is on page with notification field data like, id, name, type, etc... so trying to get that field data passed to the paragraph template.

I couldnt find anything specific in the `dismissible_message_bar.notification_service` service and the `template_preprocess_dmb_notifications_entity` didnt seem to work for me.

Is there any method for passing the field data to the template?

Thanks!

πŸ’¬ Support request
Status

Active

Version

1.9

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States justclint

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @justclint
  • πŸ‡ΊπŸ‡ΈUnited States Mojiferous

    The notification data is on the notification entity which is the parent entity of the display paragraph - so you should be able to call -> getParentEntity() on the paragraph and then load fields from there. You could probably do that in a preprocess for the paragraphs and add them into the variables for the template

  • πŸ‡ΊπŸ‡ΈUnited States justclint

    Thanks Mojiferous! That worked.

Production build 0.69.0 2024