What's the URI of the page I'm on?

I'm sure there's a very simple answer to this, but I need to determine the URL, URI, whatever, of the page that this template is currently executing on.

When I try to see what's in the Twig global variable "app" I get NULL. When I try to see what's in the variable "parent" I get NULL.

Thank you.

Attach javascript file to a specific block

Hello all,

I tried in mytheme.theme

function mytheme_preprocess_block(&$variables) {
  if ($variables['elements']['#id'] == 'myblock') {
    $variables['#attached']['library'][] = 'js/readmore.min.js';
  }
}

I get:
User warning: The following theme is missing from the file system: js in drupal_get_filename() ...core/includes/bootstrap.inc

readmore.min.js is present in themes/mytheme/js/

RuntimeException in Symfony

I'm getting a PHP error listed in my recent log messages and I can't figure out what's wrong. Please can someone help?

RuntimeException: Failed to start the session because headers have already been sent by "/Volumes/HDD/Tom/Documents/Projects/drupal/vendor/symfony/http-foundation/Response.php" at line 359. in Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (line 144 of /Volumes/HDD/Tom/Documents/Projects/drupal/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php).

Same block in two places; how to use different templates?

I have put main navigation to two different areas. In area A the blocks shows only level 1 menu items and on area B it shows from level 2 to N. Now I would like to use different twig template for these two blocks but it seems that they both just use the same template. Is there any way to make two separate templates or even identify these two blocks so that I could make some if-else to the template file?

Drupal Cache

Hi,

I did a custom block who can display data from database. It is displaying with the function build(), so i have to clear the cache everytime my data are changed in the database, to update the displayed data.

Is it possible toi create a php file who is executed everyday (cron) ? Or any other solution to clear the cache automatically ?

Help installing Drupal

Hey I arrived at the installation site and it tells me this why?
Only local images are allowed.
Only local images are allowed.

Pages

Subscribe with RSS Subscribe to RSS - Drupal 8.x