Latest Drupal related questions

Score: 0
Check if a group of fields have a unique value
pe flag

I use webform and I have a group of 5 star fields (Rateit.js) that can be rated from 1 to 5 stars. The users must enter unique values. For example, they score 5 solutions with 1 to 5 stars; they cannot score two solutions with 3 stars.

screenshot

I tested with unique, unique per entity, and unique per use options, but it does not work.

Could this be the solution or is it not for my problem at all?

enter image description here

I tho ...

Score: 0
Placeholder is replaced with label text
cn flag

I am new in Drupal Community, I am trying to create a form using webform module in drupal 8, i have setup the placeholder for textfield but it won't show on the form, its taking label as placeholder. i have spent a lot of time to check the settings but unable to find such setting can any one help me to resolve this issue,

attaching screenshot of textfield setting and from:

enter image description here

enter image description here

please check above ss  ...

Score: -3
Jeirod avatar
Open new tab with external link using an image button
cn flag

I am making a custom module with a form that has an image button. The image button will open the external link with the value of a textfield inside the form. I have searched any possible solution in the internet but can't find a solution.

How do I code a submitForm button to open an external link with a form value of a textfield inside the form.

Below is my sample codes:

$form['search'] = [             
 ...
Score: 0
Unable to inherit profile
ye flag

I am trying to create a custom installation profile which will use standard as a base profile. So I created the customprofile.info.yml as below:

name: 'Custom profile'
core_version_requirement: '^9'
type: profile
base profile: standard
  
description: 'The custom Drupal profile for all CMS websites based upon standard.'
install:
  - menu_ui
  

themes:
  - bartik

But I am not getting any modules which ...

Score: 0
Hasina Njaratin avatar
Render fields and results of a custom form in two separated regions
de flag

I have a custom form (created programmatically). I want to keep the AJAX submission mode. I would like to render the fields of the form in a region SIDEBAR and then the results in the region CONTENT.

I was thinking about putting in two separated blocks but I have no idea on how to handle this in terms of template and result synchronization.

Does anyone have any idea on how to do this? Is it possible ...

Score: 0
Attach file to webform submission email from "Entity select" entity
fr flag

I am trying to attach a file from a entity reference in a Webform. The form is basically like this:

information:
  '#type': wizard_page
  '#title': 'Information'
  machine_floor_plan:
    '#type': entity_select
    '#title': 'Select file node'
    '#multiple': true
    '#sort_options': true
    '#select2': true
    '#target_type': node
    '#selection_handler': views
    '#selection_settings':
     ...
Score: 0
Using Tac Lite in combination with Paragraphs
ma flag

For our new Drupal 9 (or 8 if necc.) website we require a very fine controllable access structure where we can give and restrict access on a user by user basis. Not only for a content type but also for the paragraphs (or more atomic components of a page). With Tac Lite we can already set the permission via taxonomy terms on a user bases to view a node. But now we would like to also controll single parag ...

Score: -3
nicola avatar
Show the same content with different urls
th flag

I need to show the same content with different urls.

I would like to create dynamic routes when saving a node in Drupal 9.

Does this seem the right way?

Some other solution or similar module.

A specific use case:

node/1 -> 'How to sign up'

url -> '/actor/how-to-sign-up', '/supporter/how-to-sign-up'

P.S. I need the first part of the path (actor,supporter) for various checks

Score: 2
How can I programmatically delete a user without deleting their content?
us flag

I want to delete a user with this code:

$account = User::load(19920);
$account->delete();

How can I do that without also deleting the user's content?

I've been reviewing _user_cancel() hooks, but they all seem to be about doing things in the admin UI.

This hook works the way I expect it to and removes the user_cancel_delete radio button option from the admin UI.

/**
 * Implements hook_user_can ...
Score: 0
jmzea avatar
Syncing of order and shipping states
br flag

In Drupal 9, I have defined the following order workflow for Drupal Commerce:

miss_pomela_fulfillment_processing:
  id: miss_pomela_fulfillment_processing
  group: commerce_order
  label: 'Miss Pomela Fulfillment, with processing'
  states:
    draft:
      label: Draft
    pending:
      label: Pending
    processing:
      label: En preparación
    packed:
      label: Ready to ship
    fulfillm ...
Score: 0
jfc avatar
Is there a way to render the title of every node from a single content type?
us flag
jfc

I have a page on a Drupal 9 site that will have a filter and a search bar. The filter needs to have each product and each region the product is sold in.

So I created 2 content types - Product and Region, and created a node for each one that just has a title.

I want to loop through each Product and Region node and display them on the page that has the filter.

Is it possible to render this data in a TWIG ...

Score: -2
Jeirod avatar
Can I use two different forms in one module?
cn flag

I'm new to Drupal 8 and I was wondering if I can use two forms which are inside the Form folder(mymodule/src/Form/). The name of my forms are FormOne.php and FormTwo.php.

I can only display and use FormOne.php through my entire module.

I have researched it and can't find an answer.

Can you help me on displaying the second form?

Score: -1
ridd avatar
How can I programmatically replace a string on the front page?
la flag

I create a custom module which replaces some string on the front page. For nodes, it work correctly, but it doesn't work on the front page. I wrote this code.

function my_module_preprocess_page(&$variables) {
  if (\Drupal::routeMatch()->getRouteName() == 'view.frontpage.page_1') {
    $generateBlock = NULL;
    $block_manager = \Drupal::service('plugin.manager.block');
    $block_config = []; ...
Score: 0
Create a list of blocks and the pages they are currently being used on
cn flag

We have a D9 site that makes extensive use of Layout Builder. One of the features our content editors use is creating a global custom block in the Custom Block Library and then on various pages they may place that global block using layout builder. They made a request asking us if there was a way to tell what pages in the system certain blocks are currently being used. They have about 700 pages and they ...

Score: 0
Kevin avatar
Gracefully handle URL/URI/Link exceptions when using Link field formatter?
in flag

Occasionally I am encountering an error along these lines:

The website encountered an unexpected error. Please try again later.InvalidArgumentException: The URI 'XYZ' is invalid. You must use a valid URI scheme. in Drupal\Core\Url::fromUri() (line 290 of core/lib/Drupal/Core/Url.php).

We are migrating data frequently and one thing that can happen is link field URIs can come in like that. The core Link ...

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.