0

I recently installed the "simplenews" and "simplenews_scheduler" modules. The first module generates a view where you can see the newsletters.

My idea was to create a relationship in that view to gather the data from the "simplenews_scheduler" table to know if a newsletter has an active schedule.

enter image description here

I tried the "views_data" and "views_data_alter" hooks but I can't add the "activated" field of the "simplenews_scheduler" table. The base table of the view is "node_field_data"

enter image description here

Is it possible to do what I'm trying to do? And if so, can someone tell me what I should do? Thank you very much.

1 Answer 1

1

To create a view from a database table instead of using hook_views_data you can use Views Custom Table module:

View custom table module provide you functionality to integrate your custom table data to views, and access all it's column in views. This module use hook_view_data to add custom tables in views.

it's easy just follow the 7 steps in How to use section in module page.

4
  • Yes, I saw it, but I was trying to avoid use it due to the low usage statistics of the module
    – Javier Rey
    Aug 13, 2020 at 10:26
  • i have worked with it, it's good, it's stable and 1,603 site using it, what's the problem, besides the module just implement hook_views_data dynamically based on the config you set
    – berramou
    Aug 13, 2020 at 10:49
  • I've tried it and it works fine, but that's not a decision that's up to me :/
    – Javier Rey
    Aug 13, 2020 at 10:52
  • in that case follow this tuto lullabot.com/articles/… to create your own Views Query Plugin !
    – berramou
    Aug 13, 2020 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.