Latest Drupal related questions

Score: 0
TKY avatar
How to filter out content by compare field value in user profile?
in flag
TKY

Is there any way to filter out content by compare values of the same field in nodes and user profile?

  1. I have a fivestar rating field "field_diffculty" in several content types and user profile
  2. The goal is to filter out nodes with values of "field_diffculty" which equal or lower than the same field in current login user profile.
  3. In views, it seems very hard to do such a comparison, for user and content  ...
Score: 1
Override the default private file access
in flag

In the site I am developing, the private files directory is outside the document root.
I have a content type (Chapter) with a file field that stores its files in the private files directory. When a Chapter node is published, its file is accessible to users, but when the node is unpublished, its file is not accessible to users. They get an access denied page.

How can I control the access to the attached  ...

Score: 3
How to re-index all content for the core search engine?
br flag

Is there a way to re-index all content for the core search engine?

In older versions, you could reindex with drush:

drush search-reindex --immediate --verbose

However, this does not appear to be an option anymore. In more recent versions of drush, one can do this:

drush search-api-reindex

However, that command is for the Search API module, and not for the core search index.

How do I re-index th ...

Score: 1
Baud avatar
Reverse proxy and auto_complete with mixed content
sa flag

I have an apache configuration with reverse proxy (IP of this server: 192.168.1.82) to handle my new D9 server:

192.168.1.82 : 443 is passed to 192.168.1.87 as HTTP(80)

<VirtualHost *:443>
    ServerName www.mydomain.be
    ServerAlias mydomain.be
    NameVirtualHost www.mydomain.be

    ProxyPreserveHost On
    ProxyPass / http://192.168.1.87:80/
    ProxyPassReverse / http://192.168.1.87/
     ...
Score: 0
spiralarts avatar
Access to Webform on maintenance mode
cn flag

I've been trying to give access to a specific webform on maintenance mode without any success. Is there a way to do this?

Score: 0
Does the "Search keywords" exposed filter depend on the core search index?
br flag

If I create an exposed Search keywords filter for a view, does this functionality depend on the core search engine? Do I need to index the site at admin/config/search/pages for a Search keywords filter to work?

Score: 1
How do I make a theme suggestion using a field ID and the node ID?
tr flag

I'm trying to make a theme suggestion for form-element--first-name--23.html.twig using the following function, based on some information from Drupal 8 / 9 – Adding theme suggestions for node id specific field template.

EDIT: Not sure what needs to be clarified, per admin. But to reiterate, I can't figure out how to make a theme suggestion using a field ID and node ID in the same suggestion. The  ...

Score: 0
Ex0r avatar
Creating a form in a custom views field
cn flag

I am working on a bit of functionality that allows a 'form' to be embedded in a custom views field on a view I am working on.

The view is a table list of 'request' entities. The very last column in the table for each row is a 'quick edit' form, that has a custom form with a few fields on it (depending on the entity displayed in the current row). I am trying to figure out how to build a custom vie ...

Score: 0
Mismatch in php version status vs php -v
cn flag

I have multiple versions (7.2 and 7.4) on my ubuntu box and recently set the server to use 7.4 so that I could upgrade Drupal from 8.9 to 9.x.

Drupal reports/status shows my php version as 7.2, where as php -v and drush report the version as 7.4.

How ensure that Drupal sees the 7.4 version?

Score: 0
angela83 avatar
How to clear selected values from multiple select field
in flag

I have a form with a multiple select field where a user can select several values in it

$form['export_type_section']['export_type']  = array(
  '#title' => t('Export types'),
  '#type' => 'select',
  '#multiple' => TRUE,
  '#size' => 10, 
  '#options' => $options,
  '#ajax' => array(
    'event' => 'change',
    'callback' => 'test_export_form_export_type_ajax_callback',
  ) ...
Score: 0
How do i save a base64 decoded image to file_managed?
cn flag

I'm trying to save my image to Drupal's file_managed table. However, my image is coming from base64 decode:

 $filename = "sign-".$user->id(); // returns "sign-1234"
 $image_raw = $form_state->getValue('signature'); // returns base64 string of png
 $data = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image_raw));
 $image = file_put_contents('private://requestformfiles/'.$filename.'.p ...
Score: 0
chap avatar
Strange "Mismatched entity and/or field definitions" error
tn flag

I know there are plenty of other threads about this but I believe mine is a strange one and I've spent the last day debugging its cause with no luck so far, so hoping someone with more knowledge about schemas/field storage can help me.

First, a little background on what I am doing. I have a set of config which is packaged up using the features module and deployed as a package to a number of our o ...

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.