Latest Drupal related questions

Score: 0
Renato Francia avatar
related by entity reference module views in Drupal 9
id flag

I have two content types:

Company:

  • body
  • field_events (Entity reference)

Events

  • body
  • field_company (Entity reference)

I have created a view that has this setup:

View Settings:

Fields:

  • (field_events: Content) Content: Title

Filter Criteria:

  • Content: Published (= Yes)
  • Content: Content type (= Company)

Contextual Filters:

  • (field_events: Content) Content: ID

Relationship:

  • field_events: Content
Score: 0
DeveloperWeeks avatar
CKEditor hides from my testing tool
ch flag

I am building an automated testing tool for the drupal site that I maintain. The site has migrated to D9 and functions normally for a human user. When my python scripts pull up selenium/Chrome browser and go to the Create Content Page page, CKEditor does not process the body field.
I open my chrome browser and sign in with the same credentials and CKEditor appears.

My python bot is able to create nod ...

Score: 1
user14409370 avatar
better search results for view taxonomy terms
nr flag

A view with a taxonomy term field doesn't let you configure 'contains' like you can using title or body. Using "one of" as the alternative, a "first-name second-name" entry does not show results when searching on "second-name first-name". Which is a pain.

Title and body let you:

Taxonomy terms don't

Searching for "Bobby Brown" will show results, "Brown Bobby" will not Does any one know a solution?

Score: 0
How to duplicate a view as a page for another view
cn flag

I have 5 views in the back office, each view contains in the display a single page with different fields and filter criteria and other configuration, I would like to gather all the 5 views/pages as 5 pages for another sixth view, is there a possible way to duplicate a view as page for another view ?

Score: 0
Jorn Reed avatar
Redirecting to a route name
il flag

I've recently built a module. In the twig template that I render, you can delete an item. For example it goes to /delete/item/1. That works fine. that route triggers a delete method from my controller

public function deleteFittest(){
    $connection = \Drupal::service('database');
    $query = $connection->delete('user_fittests')
    ->condition('id', \Drupal::request()->query->get('id'))
     ...
Score: 2
Baud avatar
addViolation() is deprecated: how to replace it?
sa flag

How to adapt the following code to avoid the deprecation of addViolation() according to https://www.drupal.org/node/3238432 ?

class MyValidator extends ConstraintValidator {

  public function validate($items, Constraint $constraint) {
    if (!$this->isValid($items)) {
      $this->context->addViolation($constraint->message); // How to adapt this line?
    }
  }
}
Score: 0
Zdeněk Nováček avatar
Commerce: Required product SKU is missing
in flag

I searched a lot, but did not find a solution, import preview works fine (attached picture), SKU is mapped, but actual import does not import anything, ends with "Required product SKU is missing.", Drupal 7 in latest version, feeds 7.x-2.0-beta4 (tried 7.x-2.0-beta5 and latest dev and not working as well) It was working before. PHP 7.2

CSV done on Mac Numbers, checked in COda and BBEdit, looks fi ...

Score: 0
Joost avatar
views_embed_view() ignores template file using Ajax
jp flag

I have a view shown in two ways. Once I show it as a normal block and one time using views_embed_view() in combination with Ajax.

For the regular block I created a views-view-list.html.twig template in my theme adding a div wrapper. My styling is based on this added div.

For the embedded block, this views-view-list.html.twig block is ignored and therefor the styling is off.

Using views_embed_view()

Score: 0
My site content does not display after upgrading to Drupal 9
in flag

I've just completed upgrading three sites (in a multi-site configuration) from Drupal 7 to 9. For the first two simple sites, all is well. However for the third site, which has its own content types that make use of many field types, things are not so good.

When I view any node of any type (eg. page, story, one of my custom types), whether in teaser mode on the home page or in full mode, only the ...

Score: 0
Has anyone tried running Drupal 9 under Windows Datacenter 2022 IIS?
jp flag

We are running Drupal 9 happily under IIS and Windows Datacenter 2019 under Azure. Microsoft have released Windows Datacenter 2022 so I thought I should try to migrate to that platform. It opens find, but none of the links work, for example https://site/login gives a Page not found error. I have URL Rewrite installed and the same rules as in other environments; one is supposed to rewrite ^(.*)$ to index ...

Score: 0
yuuuu avatar
How can I make a white screen of death less ugly
ao flag

A project I'm working on requires custom modules, and I'll be the last person to claim that I am perfect. I've gone through and removed as many possible php errors and causes for WSODs that I can think of, and I haven't had any recently. In the case that an error does happen with my code it will affect a single page load, it won't totally take the site down. The last thing I want is a user seeing a clea ...

Score: 0
Is there a way to control how RouteProvider caches a route?
ar flag

Drupal caches routes in cache_data. This happens in Drupal\Core\Routing\RouteProvider.

I am looking at a high traffic website with "interactive" search functionality based on a map. When you resize your window or move around in the map, a couple of requests are sent to the server for search results based on the map view.

Nearly all requests will be unique, because the map coordinates are part of the req ...

Score: 2
Andrew Morris avatar
Custom AJAX Response not firing on Flag action
mw flag

I'm trying to run custom javascript functions at the same time as people interact with certain flags on my site, I have followed this tutorial on how to respond to both Flag/Unflag actions, and this site for how to setup the custom ajax responses, except it just doesn't appear to be able to combine the two

The code inside my FlagSubscriber.php file (from the first tutorial link) looks like the belo ...

Score: 0
d4t3r avatar
Overriding views title with full taxonomy hierarchy
vn flag

My Situation:
I am trying to list my content with a taxonomy hierarchy, building up a views based navigation.
To achieve this, I created a second vocabulary for my hierarchy terms (2 layers, mixed), which I attached through an entity reference field to a new content type. This entity reference field is routed through a first view, sorting out folder terms.
I then created a second view to sort, group and  ...

Score: 2
informatik-handwerk.de avatar
Programmatically find out field name of an Id-field
cn flag

Depending on the type of entity, it is either nid/vid/uid and possibly other. It is nice to have an ->id() method which allows you to work with data in an uniform fashion without relying on those details, but there are quite some use-cases, where I am running into troubles.

Just an example, getting list of revision ids for an generic entity seems not possible without knowing the name of the id-field. ...

Score: 1
Disable the "Add Link" button in entity.menu.edit_form for certain roles
ng flag

I'd like to hide the "Add Link" button in menu.edit_form for certain roles. Running dpm($form) for this form I can't find that button in there. In core there is menu_ui.links.action.yml with this snippet:

  entity.menu.add_link_form:
  route_name: entity.menu.add_link_form
  title: 'Add link'
  class: \Drupal\menu_ui\Plugin\Menu\LocalAction\MenuLinkAdd
  appears_on:
  - entity.menu.edit_form

I don't g ...

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.