Latest Drupal related questions

Score: 0
vrijdenker avatar
ElasticSearch Views integration not working with multiple words
in flag

In Drupal 9 I have setup ElasticSearch 7. I have added a Search API View in which I have added field to search through the "rendered HTML" field.

This seems all pretty basic if you ask me, however it doesn't work as expected.

For example my page contains text like "Lorem ipsum dolor sit amet".

  • If I search for "ipsum" I get the page as a result
  • If I search for "dolor" I get the same result
  • But if I  ...
Score: 0
Shyghar avatar
Create node by post Api call fail with message "Could not determine entity type bundle: \\u0022type\\u0022 field is missing."}
cn flag

I'm trying to create a node via Drupal API but I get this error:

Got error 'PHP message: PHP Fatal error:  Uncaught GuzzleHttp\\Exception\\ClientException: Client error: `POST https://site.it/entity/node?_format=hal_json` resulted in a `422 Unprocessable Entity` response:\n{"message":"Could not determine entity type bundle: \\u0022type\\u0022 field is missing."}

This is my function:

public functi ...
Score: 0
Елин Й. avatar
How to set an encrypted file field's value programmatically
je flag

I'm trying to set an encrypted file field's value programmatically. I'm using Encrypted Files module. I have successfully configured a file field, and it works for the contents created using the node add form.

In a custom code, I'm getting a file using the HttpClient and want to attach to a media. I could get the file, encyrpt and save it. However, if I want to open the file, it is broken.

What I'm doin ...

Score: 0
Customer profiles cannot hold more than 1 values, even when allowing multiple profiles per user
in flag

I have custom API that creates new Customer profiles with different addresses / emails:

$profileStorage->create([
        'type' => 'customer',
        'uid' => $this->currentUser->id(),
        'status'=> 1,
        'address' => $addressData
])
$profile->setDefault(true);
$profile->save();

It works creating those profiles and attaching them to the current user. However,  ...

Score: 0
jacksparrow avatar
Can't find "starts with" for Filter criteria In Views (indexed field for taxonomy)
ve flag

I created a view using indexed fields (search api) to list a taxonomy. I used the rest export checkbox so I have an api endpoint for my view. I am not able to find a filter criteria "starts with" for a field (indexed) that is a string. I don't understand why, the field is behaving like an integer and showing greater than, less than etc..

I am trying to use the hook_views_query_alter but I am gett ...

Score: 0
Greg Sims avatar
Custom Module Rename
us flag

We have three custom pieces of code for our Drupal website: module, theme and a non-drupal php library. The names of these components have become awkward over time. I would like to rename our custom module from "rsm_library" to "rsm_module".

I created a copy of "rsm_library" on Github as "rsm_module". I then changed all of the internal references from "rsm_library" to "rsm_module". These chang ...

Score: 3
quantumized avatar
Status page shows "Mismatched Entity.." for a Paragraph field but Drush entup give error "..storage cannot change the schema for an existing field"
ng flag

I'm stuck in a loop. The Drupal 9.3 status page shows the following error:

Mismatched entity and/or field definitions
The following changes were detected in the entity type and field definitions.
Paragraph
The paragraph.field_heading field needs to be updated.

When I run drush entup I get the below error. I have a lot of data in the mentioned field so I can't delete the field. How did this mismatch ...

Score: 1
Is it possible to create a view of a user's content and content they've flagged?
tr flag

I'm trying to build a view that displays nodes authored by a user AND nodes flagged by the user (but are authored by other users). All the nodes are the same content type. I can create the two views separately, but I'm wondering if there's a way to combine them into one view?

Score: 0
Franko avatar
Allowing specific users to flag/book mark content that is then displayed on a specific page for their team to view publicly
jp flag

I need help figuring this out, I need to allow specific users (a designated role) to create listings (a pre-built views) of existing content by selection (bookmarking) and share it with their own teams. These users need to just click a button/link and then article will be added to a specific view for their own team to see. A team lead assigning certain articles to a list that then can be viewed by othe ...

Score: 2
Safely save data to the order in onNotify()
jp flag

I'm new to Drupal and have to make an off-site payment gateway (with Drupal Commerce 2). It all works, but sometimes it doesn't.

The remote payment provider's server sends notification requests to the server, about the status of the payment, so I have both onReturn and onNotify in the PaymentGateway class.

Since onReturn is not guaranteed to be called (the customer might close the browser, etc, and t ...

Score: 0
user562142 avatar
How can I set the purchased entity for an order item?
in flag

We have migrated products and orders from a Drupal 6 site to Drupal 9 site. We had a product type dues for which we already had products in the existing Drupal 9 system. So we skipped the migration of the products of type Dues. Now, After getting the Orders migrated the commerce_order_item table doesn't contain a purchased_entity id for Order Items that contained a product of type dues in Drupal 6. I ha ...

Score: 0
May  avatar
Managed file in theme config not saving
zw flag

In my theme settings under 'admin/appearance/settings/mytheme' I am trying to add an image field.

I have added the following to mytheme.theme

function mytheme_form_system_theme_settings_alter(&$form, Drupal\Core\Form\FormStateInterface $form_state) {
  $form['mytheme_settings']['footer_info']['footer_image'] = array(
    '#type' => 'managed_file',
    '#title' => 'footer image',
    '#name'  ...
Score: 0
Gabriel Fernandez avatar
Cannot Login, error msg shows "To log in to this site, your browser must accept cookies from the domain"
cn flag

On my dev environment hosted on the cloud which has SSL, I added this to the settings.php

$secure = true; // if you only want to receive the cookie over HTTPS
$httponly = true; // prevent JavaScript access to session cookie
$samesite = 'none';

if(PHP_VERSION_ID < 70300) {
  session_set_cookie_params($maxlifetime, '/; samesite='.$samesite, $_SERVER['HTTP_HOST'], $secure, $httponly);
} else {
  s ...
Score: 0
Get the value of Entity reference revisions field in order email twig file
ls flag

I want to get the entity reference field value in order email.

Name of the entity reference is field_price_value and called paragraph field is field_price now I want to get the field price value I tried below method but none work for me

 order_entity.field_price_value.field_price.value

 {% for order_item in order_entity.getItems %}

{{ order_item.getPurchasedEntity.getfield_price_value.getfield_price

{ ...
Score: 2
Atam Dhillon avatar
Disable submissions basing on a form element value/selection
ca flag

I know I can turn submissions being saved in the database either on or off completely.

Is there a way I can avoid the submission is saved basing on the value selected for a form element, for example a Yes/No radio button?

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

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.