New answers tagged

2 votes

Unable to upgrade from Drupal 9.5.10 to 10.1.1

I was able to upgrade from 9.5.10 to 10.1.1 using a number of the comments and solutions listed here so just wanted to have it in one place, in case someone else hits the wall like I did: First, ...
alex's user avatar
  • 41
0 votes

How do I move taxonomy, content and content types?

If you have access to drush, can you use the following drush commands. https://drushcommands.com/drush-8x/migrate/ Or you can install this module to export the taxonomy (D8 or D9 Compatible). https://...
salah-1's user avatar
  • 214
1 vote
Accepted

Get the view object in a custom block plugin

To Get View object in custom block plugin you can follow this snippet code: (Drupal 9/10) use Drupal\views\Views; // Get current route object. $route = \Drupal::routeMatch()->getRouteObject(); ...
mini's user avatar
  • 44
0 votes

Get the view object in a custom block plugin

I am not sure I follow your question entirely, but when you make a views page, you should have all of the regions all of your other pages have, you just put your block in there like you would any ...
Daniel Lefebvre's user avatar
0 votes

Why does not this code work?

Below code is working for me if (once('addedtocart', '#addtocart', context).length) { $('#addtocart').on('click', function () { var product_id = document.getElementById("addtocart")....
Z CHAMP's user avatar
  • 32
1 vote
Accepted

How can I get the numeric ID for a block from within the block template or hook_preprocess_block?

You can check yourself with Xdebug or Kint. /** * Implements hook_preprocess_HOOK(). */ function MYMODULE_preprocess_block(&$variables) { // Check if it's a content block. if ($variables['...
leymannx's user avatar
  • 17.6k
0 votes
Accepted

Why can't I disable CSS caching?

For some reason, the isolated fixes didn't work for me. After many more attempts, I was finally able to find a solution that works for me, and it turned out to be a combination of most of my attempts. ...
GeorgeCiesinski's user avatar
3 votes

Why does not this code work?

The new once() function from the new v10 core/once library always returns an array of elements (even if the selector matches only a single element). And vanilla JS arrays don't have a .on() function. ...
Hudri's user avatar
  • 5,244
2 votes

Why does not this code work?

jQuery Once was deprecated in Drupal 9 and removed from Drupal 10. The change record includes a conversion guide.
cilefen's user avatar
  • 5,270
0 votes

An image with filename X and weight of about 500 KB has filename Y and weight of about 10 MB

You could enable "Embed media" in the text format and use the "Drupal Media" button to add images in CKeditor. Configure the media type Image www.example.com/admin/structure/media/...
4uk4's user avatar
  • 97k
0 votes

Why does this Twig code not work?

To answer my question: With the upgrade to Drupal 10.1,Twig 3.x treats unix timestamps differently. Instead of using the twig field {{ created }}, use the raw value {{ created__raw }} followed by the ...
user189842's user avatar
1 vote
Accepted

How to remove a region from a content type?

Try to force install 5.0 version, that has D10 support: composer require 'drupal/context:^5.0@RC'
Vanish's user avatar
  • 116
-1 votes

View not showing result based on taxonomy term contextual filter

I found the taxonomy_index table have missing data, so records did not show.
Drupal's user avatar
  • 1
2 votes

Translatable custom entity

Indeed, the items above are no longer sufficient, some others have to be specified as well: $definition_update_manager = \Drupal::entityDefinitionUpdateManager(); $entity_type = $...
Gábor's user avatar
  • 801
-3 votes

How to style an <hr> element?

Remove CKEditor from that text format.
cilefen's user avatar
  • 5,270
1 vote

Why can't I disable CSS caching?

It's definitely the browser as commented by @No Sssweat. Clearing the browser cache should load a new version of static CSS files. Also putting the browser in dev mode or configuring the webserver to ...
4uk4's user avatar
  • 97k
1 vote
Accepted

Why do routes created in a React router that do not exist in Drupal give a 404 when I reload the browser?

There is a 404 because JavaScript routers can create paths in the browser which do not actually exist on the backend web application, and the router pushes those paths onto the browser history. For ...
cilefen's user avatar
  • 5,270
0 votes

menu.tree_storage service is missing from my site

In case this helps someone else: Since we only use the load method of the MenuTreeStorage class, we were able to replace it with the MenuLinkManager. - $container->get('menu.tree_storage'), + ...
Jelle's user avatar
  • 458
0 votes
Accepted

Custom webform Element not rendered

Ok, this was a really stupid mistake! my src/Element folder had actually a space in the name. correct: src/Element/PersonCountElement.php wrong: src/Element /PersonCountElement.php With the correct ...
Andreas's user avatar
  • 372
3 votes
Accepted

Website doesn't load properly from htdocs/web

This is very limited shared-hosting, no control panel and no way to edit apache's configs, only .htacess files accessible in htdocs Look for a new hosting company, until then you can use the legacy ...
4uk4's user avatar
  • 97k
2 votes
Accepted

Struggling to enable twig debugging

Since Drupal 10.1.0 Twig debugging seems to be actived/deactivated according some settings stored in the state table: Change record. This prevents that these settings can be accidentally committed. ...
leymannx's user avatar
  • 17.6k
2 votes
Accepted

How can I identify the service ID?

These are the first two entries in the services file you have linked: services: Drupal\cdn\CdnSettings: arguments: ['@config.factory'] Drupal\cdn\File\FileUrlGenerator: public: false ...
4uk4's user avatar
  • 97k

Top 50 recent answers are included