How to check that module installed in Drupal 9?
if (\Drupal::service('module_handler')->moduleExists('locale')) {
// your code here
}
if (\Drupal::service('module_handler')->moduleExists('locale')) {
// your code here
}
To solve this issue we can use a small, but a very useful module Route condition. This module provides condition plugin, which will display the block based on routes. Basically it works the same way as Pages condition plugin. So, I believe you will not find any issues configure it.
Let's imagine we have a node with field category and we want to create a link in the view and pass a category in the request ?field_category=1. Unfortunately, it will not like this by default. Fortunately, we have a solution! We need a module prepopulated and pass a parameter a special way:
1) For entity reference fields
http://yourdoamain.com/node/add/page?edit[field_category][widget][0][target_id]=1
2) Normal fields
http://yourdoamain.com/node/add/page?edit[field_body][widget][0][value]=Something