Latest Drupal related questions

Score: 0
Mira chalak avatar
html Form within a block
eg flag

I have a form within custom block in drupal 8 and I know that this is not the right method to write a form within a block but someone wrote it and I am trying to fix it without changing the method. In the return of the public function build() , he rendered the html of a form within the markup.

 return array(
      '#markup' => '<form>
//we have here many inputs
//then at the end:       
 <in ...
Score: 0
How do I add a custom URL for node/add/{custom-content-type}?
th flag

I have a custom content type which I fill up with the help of the Forms Steps module.

I want to set custom URL for node/add/{custom-content-type}. I tried using a route subscriber and the following code.

/**
 * {@inheritdoc}
 */
protected function alterRoutes(RouteCollection $collection) { 
  if ($route = $collection->get('node.add_page')) {
    $current_uri = \Drupal::request()->getRequestUri();
  ...
Score: 2
Monika avatar
CSRF token is not varying in Ajax callback while submitting form
us flag

I have a form with ajax callback as following , on each submit token is not varying , it remains constant for all submit .

wall.routing.yml

wall.commentform:
  path: '/commentform'
  defaults:
    _title: 'Comment form'
    _form: '\Drupal\wall\Form\WallCommentPost'
  requirements:
    _permission: 'access content'
    _csrf_token: 'TRUE'

In from as following

WallCommentPost.php

$ajax = [
  'callback'  ...
Score: 0
How to get a product variant field (not attribute) value?
au flag

I have created a product variant with 1 attribute (say "Subscription Plan" or attribute_sub_plan) and 1 field (say "Number of Issues" or field_num_issues). The attribute was for human readability while the field was an integer for internal use.

The attribute was added to the variation type when created, while the field was added to the variation type on the "Add field" button after creation. I can se ...

Score: 1
steevee666 avatar
How do I organize the display of product variation fields?
in flag

I have a new site with Drupal 9 and Commerce 2. I am trying to display my products with:

  • Title
  • Photo
  • Price
  • Delay
  • Options
  • Add to cart button
  • Description

I tested all the possible settings in manage display, but nothing works. What I get is inconsistent with the configuration.

How do I organize the display of product variation fields?

screenshot

screenshot

screenshot

Score: 0
tonytheferg avatar
How to create a dblog record from a views exposed form submission
cn flag

I am trying to create a log record of searches made though my Search API View exposed form block in Drupal 9.

For some reason on a brand new search I get 2 duplicates (3 total entries), and it seems like I remember reading somewhere that the forms can be submitted multiple times. So I would like to know how I could eliminate that.

Update: here is an issue for Drupal 7 https://www.drupal.org/project/views/ ...

Score: 0
stoncu avatar
Views contextual display based on taxonomy for no value
cn flag

I have a content type that has a name field and a taxonomy field that contains cities. I want the view to display by default the city as title and the message "nobody lives in city X" for each of the cities, i.e. "Nobody lives in New York" before I create any content. Once I create a person and select New York, it should display "John lives in New York". I assume this involves contextual filters and may ...

Score: 0
How to get current user jwt token?
ni flag

In a custom module, I need to get the jwt token (access_token) related to the current user. Following this issue I've tried to get it, but without success, because get_jwt_key() and jwt_token_params() are not defined and I can't find where they are defined:

use \Firebase\JWT\JWT;
...    
public function getAccessToken() {
  $uid = \Drupal::currentUser()->id();
  // Add JWT access_token
  $key = get_ ...
Score: 1
calfie avatar
Parent node needs to display the scheduled date that is referenced in the child node
sa flag

I'm not sure how best to approach this problem and I'm hoping someone can point me in the right direction.

Quick summary of the setup of some nodes: Node A is the parent node. Node B is a child of Node A. Node B also houses/displays webforms. We have a "form" field in Node B where we can call existing webforms and Node B will then display the webform and any additional information (entered in No ...

Score: 0
Bandita Pattanaik avatar
Upgrading core from 8.7.10 to 8.9.16
my flag

My current site version is running on Drupal 8.7.10 and I want to upgrade it to 8.9.16.

I backed up all the files and folders. Should I backup the Pathauto module, update the new Pathauto module, and start upgrading the site?
Are there other steps I need to take? How can I proceed with the update?

Score: 0
Jake13 avatar
How to remove home in a breadcrumb from a specific page in easy breadcrumbs and add carets for the breadcrumbs?
us flag

I've been using the easy breadcrumb module in Drupal 8, I enabled the option - "Include the front page as a segment in the breadcrumb" for all pages, but there are few pages for instance /custom-page where the breadcrumb trial is (Home Custom-page) how do I remove the home from these custom pages in .theme file or any alternate settings. Also the carets(>) are not appearing between the segments, ho ...

Score: 2
Giuseppe avatar
How do I apply patches from a merge request?
br flag

I used the patch #48 of Views exposed sort identifiers are not configurable. I need to update the core, and apply the latest rebased version of that.

However, the issue hasn't be marked Fixed, and I don't see any "patch file" to link in my composer.json.

How can achieve this?

Score: 0
matsbla avatar
How can I make a widget similar to the media library, just for other entities?
pe flag

I want to make widgets similar to the one that is provided by media library, but just for other entities, for instance Bibliography & Citation or even just other content. Is it possible to build similar widgets using configuration or is custom code needed?

Score: 0
Webform token won't render value in iframe
kr flag

I have an iframe in which I'm trying to include a token which is a value from a select list. In the code below, this value:

[webform_submission:values:choose_video:raw]

Won't render in the iframe, but does render directly below it, in a P tag. Is there some filter I have to apply? When I do include the token, the all the greater and less than symbols are escaped in the iframe. Code is below. Thanks fo ...

Score: 0
Vivank Sharma avatar
Extract more data on field_collection_item from REST APIs of Drupal
lb flag

I am trying to display information regarding Contributed modules available on Drupal programmatically.

For that, I am taking the help of this documentation : https://www.drupal.org/drupalorg/docs/apis/rest-and-other-apis

When I am calling API like: https://www.drupal.org/api-d7/node.json?field_project_machine_name=ctools

In return I am receiving a JSON object with the following details:

"field_supp ...

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.