Get info from Menu->Links to Dynamic Link Table

Hello,

I have one problem. I have two Doctypes, A and B. Inside Doctype A i have table in which on each row i link few docnames of doctype B.
When i go to some docname of doctype B and click on Menu->Links i can see on dialog the docname of doctype A in which i linked docname of doctype B.

I would like to create inside every docname of Doctype B the table with dynamic links in which i will see the same info which i can see in Menu->Links.

How to do that? I know that everything about Menu->Links is doing by code in apps\frappe\frappe\public\js\frappe\form\linked_with.js but i really don’t know how to “copy” this info to table of dynamic links.

How this Menu->Links knows every links of Doctype B? I tried also get some information i sql database from doctype B table, but no info inside database fields …

I hope I have made it clear what I mean and please for any tips/advice.