Latest Drupal related questions

Score: 0
Jorn Reed avatar
Main page content block doesn't move
il flag

I'm currently building a Drupal 9 site. I've built some custom blocks, which I display on a specific 'basic page'. I want the 'Main Page Content' block to be above my custom blocks. So I moved the 'Main Page Content' block upwards. For some reason it didn't update, and my custom blocks are still on top.

Does anyone know why?

Score: 2
Shouldn't hook_update to add a new field to an entity use the field definition from the entity class?
hk flag

I was writing an update hook to add a new field to a custom entity and was following the pattern shown here

https://www.drupal.org/node/2554097

/**
 * Add 'revision_translation_affected' field to 'node' entities.
 */
function node_update_8001() {
  // Install the definition that this field had in
  // \Drupal\node\Entity\Node::baseFieldDefinitions()
  // at the time that this update function was wri ...
Score: 1
Problem with auto-generated url alias when attempting to make a third-level menu item
cn flag

Using [node:menu-link:parents]/[node:title] as the pattern for nodes in Url Aliases works fine for a menu that is only two levels, but if I attempt to assign a node to a third level under a menu, instead of getting top-level-node/2nd-level-node/third-level-node as the url alias, I get top-level-node-2nd-level-node/third-level-node as the alias. Is this the expected behavior? Is there a way to auto-gener ...

Score: -2
matsbla avatar
How to make users stay logged in across devices?
pe flag

https://api.drupal.org/api/drupal/core!modules!user!user.module/function/user_login_finalize/9.2.x regenerates the sessions each time the user logs in. This can become a little hassle if user for instance switch between working between different deices (e.g. mobile + laptop). Is there any way to make the user stay logged in across devices?

Score: 0
xpersonas avatar
Drupal Solr No Results
cn flag

I have a SOLR sever set up (using platform.sh). I have it configured, connected, and indexing. However, I get no results when I search. (I've tried search api pages and views - no results with either). I tried to make sure node titles were indexed and I know "iconic" would be in a title. But I get no results.

I'm at a loss. I don't really know where to go next.

If anyone can help, I've tried to post ...

Score: -1
Gilles9999 avatar
Aegir Drupal 7 Website migration
it flag

I need desperately help. I clarify that I am not a developer but I have just basic knowledge of Drupal and Aegir. Few years ago a developer guy installed Aegir on VPS (Hostwind) and Drupal. Now Hostwind decided to interrupt this service and I have to migrate.

My question is: what is best option to migrate?

Should I migrate Drupal and Aegir or just Drupal (without Aegir)? Is it possible to migrate on ...

Score: 1
How do I programmatically create an entity type from the install yml file?
au flag

I'm currently writing a module. In an update, I need to programmatically create a new entity type.

I have already created a suitable yml for installation. Like this one, except it is not a Node Type entity, but a custom entity type entity.

For the sake of consistency, I'd like to use the yml directly in my updateN hook. Is there anyway I can simply use the config yml to create this new entity type?

 ...
Score: 0
How to display the current year in the template of a block?
cn flag

I'm trying to rewrite the "Powered by Drupal" block. I want to display the current year in my code but cale does not work. The website displays a blank page with the message "The website encountered an unexpected error. Please try again later."

This error appears when I add {{ 'now' | date('Y') }} in the code.

Here is the block template :

{% block content %}
  {{ attach_library('olivero/powered-by-blo ...
Score: 0
Maarten Hartman avatar
Persistent anonymous user session with headless D9
ck flag

In short: a new php session is started upon every request made through nextjs, I somehow must keep the anonymous user session alive.

For my anonymous users I need keep track of data submitted through nextjs. I Initially developed my app with Drupal 8.9, and many months later upgraded to 9.4-dev.

Before the upgrade to 9.4-dev, I was sure the sessions worked properly across several browsers and anonym ...

Score: -1
syter avatar
Installer can't create sqlite database
cn flag

I have a drupal page, hosted with azure webapps, on nginx. However, when i start the site, the installer wants to have a database. I am aware that it's bad, but sqlite is an intentional choice because of company reasons.

However, when i try to use sqlite it says it locked. enter image description here

I have no direct access to the files, once they are deployed. All changes have to be made locally, and then commited and pushed for a ...

Score: 0
arpitk avatar
State API doesn't work on new paragraph fields
kr flag

I have programmatically added #states into fields in a paragraph works fine for existing fields in a form. But on clicking add more button on paragraph to add more fields the hidden fields show up. I tried this Patch but it didn't work for me.

I have used this hook to alter the field to add #states.

function mymodule_field_widget_entity_reference_paragraphs_form_alter(&$element, &$form_stat ...
Score: 3
hotwebmatter avatar
String substitution in Views Contextual filter parameter?
nr flag

In Drupal 9, I have a View called News.

The View is displayed at the following path:

/news

I can edit it at the following path:

/admin/structure/views/view/news/edit

It has the following Contextual filter:

Content datasource: Content type

The contextual filter values are provided by the URL.

When the filter value is NOT in the URL: Provide default value

Type: Fixed

Fixed value: all

Exception value:

Score: 0
Ivan Ginovski avatar
Date scroller for View
jp flag

I would like to add a widget or a plugin which is a date scroller to a view page.

The widget would be on the side of the view, showing the months of the nodes that are being viewed.

So, lets say I have a view which displays nodes of content and once it is scrolled and it shows some nodes that were from the month March, the date scroller shows March.

It would look something like this:

enter image description here

Can I override it s ...

Score: -2
How do I automatically generate documentation for my site?
hk flag

I am working on a complex Drupal site with a lot of custom modules, custom entities, custom classes, custom views, custom events, custom event subscribers, custom forms, custom controllers. In short, a lot of custom code.

It is a big challenge trying to keep the technical documentation for the system updated when we keep making changes to the application on an ongoing basis.

Is there some way to gen ...

The Stunning Power of Questions

Much of an executive’s workday is spent asking others for information—requesting status updates from a team leader, for example, or questioning a counterpart in a tense negotiation. Yet unlike professionals such as litigators, journalists, and doctors, who are taught how to ask questions as an essential part of their training, few executives think of questioning as a skill that can be honed—or consider how their own answers to questions could make conversations more productive.

That’s a missed opportunity. Questioning is a uniquely powerful tool for unlocking value in organizations: It spurs learning and the exchange of ideas, it fuels innovation and performance improvement, it builds rapport and trust among team members. And it can mitigate business risk by uncovering unforeseen pitfalls and hazards.

For some people, questioning comes easily. Their natural inquisitiveness, emotional intelligence, and ability to read people put the ideal question on the tip of their tongue. But most of us don’t ask enough questions, nor do we pose our inquiries in an optimal way.

The good news is that by asking questions, we naturally improve our emotional intelligence, which in turn makes us better questioners—a virtuous cycle. In this article, we draw on insights from behavioral science research to explore how the way we frame questions and choose to answer our counterparts can influence the outcome of conversations. We offer guidance for choosing the best type, tone, sequence, and framing of questions and for deciding what and how much information to share to reap the most benefit from our interactions, not just for ourselves but for our organizations.