I have recently converted from Joomla to Drupal. I am still learning how to use it but I can't seem to find answers (esp for Drupal 9 not some ancient version usually coming up with google search) how to have same functionality of "loadposition" and "loadmodule" in Joomla, but in Drupal 9?
In Joomla, {loadposition} and {loadmodule} allows to embed modules / blocks (modules in Joomla, in Drupal I think those are called Blocks) inside an article (node) content. So that way you can call a block logic and code anywhere within an article (node) by simply adding {loadposition} to the code. Example:
I have a module (block) that displays a list of recent posts I have made. Let's call it "Recent Posts". And I want to include it on the "home page" and I also want to include it in the "blog". And I don't mean it in general, like just assigning it, but to load it precisely in that part of the code where I target it.
Recent posts module / block (aka {loadmodule recentpost} contains code:
// bla bla bla Recent Posts code
Homepage is made like this:
// bla bla bla homepage html
Blog page html:
// bla bla bla blog html
Now, let's say I want to add the recent posts code at the bottom of the content within the homepage content region, but at the same time I want to add it on the top of code before the main content code on the blog page html.
In Joomla it would end up like this:
Homepage + module / block :
// bla bla bla homepage html
{loadmodule recentpost}
Blog page + module / block :
{loadmodule recentpost}
// bla bla bla blog html
How to do this in Drupal 9? What is the equivalent of Joomla's {loadposition} and {loadmodule} in Drupal 9?
More info about {loadposition} and {loadmodule} here: https://docs.joomla.org/How_do_you_put_a_module_inside_an_article?
field_content_paragraphs
, and one paragraph type could be named "Block" which contains a Block Field that's lets you reference a block on any position within thefield_content_paragraphs
of a node. Only thing you might pay attention to I think was it only can reference block which has been placed at the Structure > Block page (maybe in a "Hidden" region). Try it out