Latest Drupal related questions

Score: 0
octogone.dev avatar
How do I import/add terms to content without removing the existing ones?
bf flag

currently when importing term with feeds all the existing term of of a content are removed and then the terms are imported.

Is there a way to add terms during an import and keep the existing ones?

Score: 0
user3099225 avatar
Restrict access to webform submission nodes for anonymous
cn flag

I have a webform in my drupal website. I am uploading a text and pdf file through it. Now I am displaying all the content in a list using a block which is accessible for everyone. It's working fine.

So for every submission there is of-course a node created dynamically. Like - http://localhost/mysite/webform/upload/submissions/3 So it can be 3, 4, 5 whatever as uploading goes on. Now i have to restri ...

Score: 1
refresh form_token with refresh page
ru flag

Unfortunately, the form_token does not change when I refresh the form pages. Doesn't this cause abuse and security risks? Can anyone explain what Drupal does for CSRF in all its forms? Thanks

Score: 0
mariosdaskalas avatar
Programmatically attach an image to a field
as flag

I am using Drupal 9.3.13 on localhost. I generate successfully a QR Code based on the .SVG format and store that image on public://. I created various field types, one of which is a field_file_svg field type.

The goal is to attach that existing image uploaded to the public:// directory and attach it to field_file_svg. I am using hook_entity_presave() for this. The QR Code is generated and stored success ...

Score: 0
khaled alsamman avatar
using 2 language switchers in the same node
cn flag

So i am not sure if this is doable or not, I am trying to add 2 language switchers block to the same node. I would like to have one language switcher for my content type that will be in charge of translating the content only. the other language switcher would be global in my navbar and will be in charge of translating the whole site.

would this idea be doable or not?

Score: 0
Cannot get entity form to display date field value
cl flag

I have an entity with two date fields. In the code that saves the entity, is:

$date_requested = date('Y-m-d', time());

and in the list of field values that get added to the entity:

->set('field_date_requested', $date_requested)

In inspecting the db, the table contains:

bundle | deleted | entity_id | revision_id | langcode | delta|field_date_requested_value
+-------+---------+-----------+---- ...
Score: 2
Andrew Morris avatar
Can I know what I'm looking at from the URL?
mw flag

I think on Drupal 7 I had previously used something like menu_get_object() to find out what content I was on. For example, with mysite.com/content/my-page, it would tell me that this was a node, its content type, its ID, etc.

Ideally I'm trying to do it even if the URL is the site's front page, I'd like to be able to reverse engineer what content it is showing me.

Score: 2
Ivan Ginovski avatar
Alter jsonlog data
jp flag

I am looking to alter the generated output of the log files from the contrib module JsonLog - https://www.drupal.org/project/jsonlog/ The logger generates a .log file, which I need to customize with a few additional fields. Is there a way to alter the data generated by the Logger class? What is the best approach for this? Is extending the Logger within a custom module a good approach?

Score: 1
Matt avatar
Set nested value in storable config
cn flag

I have a settings form that saves site wide configuration information My submit form function looks something like this

$data = [];
foreach ($groups as $key) {
  $data[$key] = $form_state->getValue($key);
  if (empty($data[$key])) {
    $data[$key] = [];
  }
}

$this->configFactory
  ->getEditable('my_config.settings')
  ->setData($data)
  ->save();

My issue is that in a callback I'd li ...

Score: -2
Load results without full page refresh
de flag

Have a view with an exposed filter some reasons for trying to add behavior manually it is working but it refreshes the entire page instead of a particular div. when I try to enable Ajax yes under the views setting means its results breaks. Anybody helps me to update the below code to achieve the results without entire page refreshes.

$form.find('select-form').change(function){
$form.find('#edit-sub ...
Score: 0
xax avatar
Fluid UI container is injected in code without location choice for the developer
in flag
xax

Problem

I have installed the FluidUI module on my D9 website. It works fine, can use all the settings to change look and feel of the website to accommodate all people with accessibility issues.

However, it injects itself into the top of the page code (immediately below admin toolbar and above the actual page content), rather than giving me options (a custom block for example?) where I'd like to plac ...

Score: 0
fombo avatar
Add a variable for each row to use in views-view-unformatted template
my flag

We are making a new website from an old Drupal 7 project. For each item within a view, I need to check if a file exists in order to enable or disable a link. In Drupal 7 we used file_exists() within the PHP template but we can't do that anymore with Twig.

I have opted for using the template_preprocess_views_view_unformatted(&$variables) function but I don't succeed in setting the variable pro ...

Score: -2
When editing a node, tab group titles are missing
in flag

When editing a node, tab group titles are missing:

Missing Table Group Titles

The HTML looks like this:

<ul class="horizontal-tabs-list">
   <li class="horizontal-tab-button horizontal-tab-button-0 first selected" tabindex="-1"><a href="#edit-group-m"><strong></strong><span class="summary"></span><span id="active-horizontal-tab" class="visually-hidden">(active tab)</span>&lt ...
Score: 0
Zabuza avatar
Get link value from menu link
cn flag

Let's say I have created a new menu node under Structure -> Menu. The name of the menu is "Footer" and for this I created a new "Menu link" called "imprint" which has a link.

Structure->Menu->menu link->link

How do I get the value of this link?

I have already tried the following, but can't get it from here:

$menuLink = \Drupal::entityTypeManager()->getStorage('menu')->load('Footer');
 ...

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.