New answers tagged 10
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, ...
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://...
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();
...
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 ...
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")....
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['...
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.
...
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.
...
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.
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/...
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 ...
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'
-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.
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 = $...
-3
votes
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 ...
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 ...
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'),
+ ...
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 ...
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 ...
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. ...
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
...
Top 50 recent answers are included
Related Tags
10 × 132theming × 17
views × 15
forms × 10
composer × 9
entities × 6
blocks × 6
nodes × 5
webforms × 5
wysiwyg × 5
database × 4
migrations × 4
commerce × 3
media × 3
hooks × 3
search × 3
uri × 3
comments × 3
installation × 3
paragraphs × 3
upgrading × 3
event-subscribers × 3
dependency-injection × 3
users × 2
javascript × 2