Hot answers tagged

3

This was a good debug deep dive. As mentioned by 4k4 the problem is the first addCacheableDependency line. Instead of passing the host entity itself, I was mistakenly passing the object returned from getParent which is a TypedData instance that does not implement CacheableDependencyInterface - thus causing the max-age to be set to 0 and the UNCACHEABLE ...


2

I would strongly advise using permissions, not roles. Permissions are super simple to create in D8+, see How do you create a custom permission to administer a custom module? The Structure or routes documentation says: _role: A specific Drupal role, for example 'administrator'. You can specify multiple ones via "," for AND and "+" for OR ...


2

It's the Links field that appears also the question's screenshot, but for the Teaser view mode, whose settings are on /admin/structure/types/manage/wikitext/display/teaser, for the Wikitext content type. (I assume wikitext is the machine name for that content type.) I changed the Teaser view mode for the Article content type and re-ordered the fields as ...


2

There are two errors in the code shown in the question. It's only the form builder that can add options to form elements. Differently, you will get the error you quoted. An invalid selection has been identified. Please contact the site administrator. What the AJAX callback does is simply returning the form element that needs to be changed. In your case, ...


1

Drush 9 drush cdel core.extension module.MYMODULE


1

What you are seeing with the "submitted by" is coming from search result excerpt. This can be configured in a few different ways, but basically, when the node is being indexed, that information is being rendered out behind the scenes and added to the index. If you want to remove that, you would want to either remove author information from ...


1

You can't use hook_ENTITY_TYPE_update() to update the entity's data. This is noted in the hook's docs: This hook runs once the entity storage has been updated. Note that hook implementations may not alter the stored entity data. Get the original entity object from $entity->original. If you need to update the entity's data, use hook_ENTITY_TYPE_presave() ...


1

We should always prefer the latest stable release. You may know that the alpha, beta versions are not completed so after all the issues are fixed & testing everything the author will update the stable release. Once we got the stable release then we can update our site later.


1

For example, we have Drupal Shield and Drupal Password Policy set on production, but we don't want to set it on development. We have the 'shield' and 'password_policy' module selected in the 'dev' configuration split we made This is your problem. This will enable the modules on Dev, not on PROD. You need to create a separate split for production, and add ...


1

When this happens I typically will do this: rm -rf vendor rm -rf web/modules/contrib composer clearcache Then run your command again... composer require 'drupal/group:^1.4'


1

As long as the values entered from users aren't concatenated directly into the string used for the SQL statement, there should not be any security risk. The code shown in the question is safe because it uses the methods that take care of handling the values entered by users to avoid any possible issue. The following code is an example of what to avoid. $db = ...


1

Objective: Show upcoming events, then past events. The simplest way to implement this entirely through the View UI is to add a second display to the view. Basic steps Create the main view display. Configure the events to display as you like. Set to sort by upcoming events, and filter so that only upcoming events are displayed. Add an Attachment display. ...


Only top voted, non community-wiki answers of a minimum length are eligible