Latest Drupal related questions

Score: 1
Vitaliy K avatar
How do I debug A block ajax issue on a custom theme?
tr flag

I'm receiving and ERROR " An error occurred while attempting to process /views/ajax?_wrapper_format=drupal_ajax: ajax.$form.ajaxSubmit is not a function" when clicking on link in views block on exposed form using the taxonomy terms and better exposed filters. enter image description here

I have tried already attach the views.ajax library to the exposed filter form. it not sorted the issue. Js aggregation also turned off.

I'm using B ...

Score: 0
Sudha avatar
Why my custom module configuration are not getting created on module install?
sj flag

I have created one custom module with config/install folder. This install folder contain content type yml. Basically on install of custom module new content type should be created. When I use drush en my_custom_module, all configuration are getting imported successfully. But when I do drush cim only module is installed but configuration(mycustommodule/config/install) are missing. Do we need to do any ch ...

Score: 0
Jake13 avatar
Format telephone numbers for values
us flag

I have created a webform with telephone field, the submitted data is displayed in a views table, however the numbers in submitted data are in random format such as 1234567890, 234-987-9870, how do I configure the number field in views to be displayed in (123) 123 1234 format for the existing values and new submission.

Score: 1
Search API Facets: Filtered Results to Map (Leaflet) Shows No Updates to Views Page
ky flag

When using post search results via a Search API Facets for node data, the initial results are displayed as a map content type (Leaflet) but when filtering down to further fields, the results page shows empty (or as set to visitor/location as set in Leaflet style settings in the corresponding View). Ajax is set in Views options. The Facets, Views pane are set within a Panel Page. The paths show initial c ...

Score: 0
Improve performance migration
br flag

I have a custom migration like this

<?php

namespace Drupal\my_import\Plugin\migrate\source;

use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Row;
use Drupal\migrate_source_csv\Plugin\migrate\source\CSV;

/**
 * Extend CSV source.
 *
 * @MigrateSource(
 *   id = "my_source_csv",
 *   source_module = "my_import"
 * )
 */
class MySourceCSV extends CSV {

  /**
   * {@inheritdoc}
  ...
Score: 0
Thomas Tsita avatar
eCommerce Products Permissions per Node
ec flag

Good day

We are building an eCommerce Platform where multiple users can be able to register, login, create, edit and delete their Profiles and Products.

The main feature is to have each user to only have access to their Products, under eCommerce.

So, the challenge is that all users are able to add, edit, update and delete all products created by all users, even when the permissions are set for each use ...

Score: 5
Monkeybrain avatar
How do I import a sync config file into my Kernel unit test?
in flag

How do I import a sync config file into my Kernel unit test ?

Specifically, I have some REST resources in files config/sync/rest.resource.foo.yml,config/sync/rest.resource.bar.yml

At present, when I run \Drupal::service('router.builder')->rebuild() in my setUp() function, it does not add in the routes for these resources, so when I make GET requests to them in the tests, I get 404.

I don't want to ...

Score: 0
divspan avatar
New pages not included in main navigation but display in sidebar
fm flag

I have recently inherited this website and was made aware of an issue where new pages that are added to the main navigation are only displaying in the sidebar. I have followed the steps for adding pages to the main navigation, but have been unsuccessful. I have also attempted to add a page that I created myself, but it only appears in the sidebar and not in the main navigation. I have cleared the cache  ...

Score: 2
ShadowAce avatar
How to duplicate/clone a field in a content type
kp flag

I have a custom content type with an image field. I want to convert this image field into media type. There are already thousands of nodes created with this content type.

One of the ways I've identified is to use the image field to media module. However this creates a clone of the image field. All the twig files and db instances will continue to use the image field.

What I'm trying to do now is to c ...

Score: 0
Cannot apply patch; file not found
br flag

There is a specialized fix to a contrib theme that I am trying to apply. Because this theme is in the .gitignore file, it's incumbent upon me to generate a patch that composer can include. Please note that the dependency "cweagans/composer-patches" is required. Pantheon is using the composer.lock file and I cannot get composer update to find the target file. I built the patch file using diff and modi ...

Score: 0
Benjamin avatar
Show List of Custom Blocks with same referenced term as the term on it's term landing page
us flag

I have a term which itself has a reference field for taxonomy terms. On the term's landing page, I would like to include a view (block), that shows custom blocks with the same referenced term (I did not have to much problems to achieve something similar with a node and custom blocks with the same term referenced - but do not achieve this on a term's landing page).

Is maybe somebody out there, who ...

Score: 0
drupaltest avatar
Custom widget with entity reference and another field - not saving
lr flag

I'm trying to create a custom field for my entity (entity A). It will hold custom entity reference, let's say entity B, with another field associated (integer).

I want to create associations entity A -> [ (entityB, 10), (entityB, 5), ...].

I followed this thread. I copied the code, just changed target type for entity B and string to integer.

The field is rendered fine - entity B with autocomplete, sea ...

Score: 0
Access field from current page in block or view
do flag

I have a custom content type. (d9)

I need to access some fields from the current page in a sidebar area. Essentially I need to make a "get more info about "field from current page" here (with a link)" in a small sidebar widget.

I am not sure how to do this.

I have tried creating a custom block type but cannot find a way to access fields on the current node. (Could I do something cheesy and access them  ...

Score: 0
Jasper avatar
Close menu (details element) after klicking anchor menu link
us flag

I have made a "Table of contents menu" on my Drupal 9 website. Here a link to a page with the menu. I use the "Paragraphs module" to add headers to my content and use views to display these as anchor links in a block. I use JavaScript to create some extra space, so the menu block doesn't overlap with the headers after clicking the anchor link. Furthermore, I use JavaScript to make the menu (details eleme ...

Score: 0
liquidcms avatar
Custom links.task for secondary tab loses primary tabs
us flag

I created a Views page and wanted to place it as a secondary task (tab) under admin/content.

I added an entry to my custom module's links.task like this:

mycustom.admin_orphaned_pages:
  title: Orphaned pages
  route_name: view.orphaned_pages.page_1
  parent_id: system.admin_content

and this works to now add a secondary task under the Admin Content page.

The issue is, when I go to this page, it lo ...

Score: 0
Baud avatar
How to translate the workflow labels defined in mymodule.workflows.yml (used by the state_machine module)
sa flag

If you are using the state_machine module, you will end up with a yaml file named mymodule.workflows.yml which contains all the labels of your workflows's states and transitions.

Here is an extract:

my_workflow:
  id: my_workflow_default
  label: 'My Workflow'
  group: my_workflows
  states:
    01_start:
      label: 'First stage'
    02_step2:
      label: 'Second stage'

How can I translate those s ...

Score: 1
How to hide the "Add new comment" link on the add new comment page
cn flag

In Drupal 8+, the "Add comment" form can be shown on a separate page by going to Manage fields for the content type that has comments and unchecking the box Show reply form on the same page as comments.

This shows an Add new comment link on the node (in this case, an article):

article with default display settings

The UX problem is that when you click the Add new comment link, you are taken to a new path (for example, comment/reply/node/2/ ...

Score: 0
Ganesh Chaudhari avatar
Getting "An illegal choice has been detected. Please contact the site administrator." error on checkout page
us flag

Drupal version: 9.5.2

On the checkout page when user tries to add new shipping address by selecting "+ Enter a new address" from selectlist, form for new address loads but shows error message "An illegal choice has been detected. Please contact the site administrator."

This is the screeshot:enter image description here

In the error log following information is getting logged:

Location: https://mysite.com/checkout/20145382/or ...

Score: 1
sk DYLAN avatar
How can I use Url::fromRoute() in a test?
cc flag

If I crate the class for test like:

class ReturnHandlerTest extends OrderKernelTestBase {

  protected static $modules = [
    'commerce_payment',
    'commerce_payment_example',
  ];

  protected function setUp(): void {
    parent::setUp();
  }

}

And if I want to use

 Url::fromRoute('commerce_payment.checkout.return', $arguments)
   ->setOptions(['absolute' => true])
   ->toString()
Score: 1
Are media entity Ajax calls cached?
in flag

In my Drupal 9 site with CKEditor 4 and I have created "media gallery" media type, which displays set of images (using slideshow module). So, when I click "insert media" CKEditor button for tool bar I have media selector popup, I can select and insert media gallery and that works well.

Only problem is that when media is inserted, that AJAX call is cached. So if I for example edit gallery, add ano ...

Score: 3
Where do you put install config translations?
in flag

I have a Drupal 9 site. When I export site config (drush cex) I get config/sync dir with settings and inside it I have i.e. language/de where translation config is stored. So translations are in config/sync/language/de (for German i.e.).

Where should go those translation files for a module? Like, for module I have config/install where my install files are. Should I have there something like: conf ...

Score: 0
resolute avatar
Send email immediately on subscribe?
ai flag

I've looked through the Drupal 8 documentation for the Message Notify and the Message modules. They don't seem very complete, so I'm hoping to get additional info.

I have several nodes that exist on a page. I want to be able to click subscribe to a node then have the current logged in user immediately notified via Email. The link will be configured as a Flag link from the Flag module. Ideally, the l ...

Score: 0
quantumized avatar
How can we redirect from a node's /latest URL if there is no latest moderation state when the user clicks it?
ng flag

Drupal 9: We want to link users to the node's "/latest" URL but if there is not currently a latest version then they get an access denied message. We'd like to, instead, redirect the user to the node without the /latest

Example:

Going to site.com/node/7944/latest when there is no latest would redirect the user to site.com/node/7944

Score: 0
Scott Hollenbeck avatar
Commerce Square Connect Order Processing
mx flag

I'm working on a patch for the Commerce Square Connect contrib module as described here:

https://www.drupal.org/project/commerce_square/issues/3228232

The patch I've developed provides basic functionality, but it has some issues that I'd like to address. I'm hoping someone who's more familiar with Commerce APIs can point me in the right direction.

The patch doesn't address shipping tax correctly. Right n ...

Score: 0
liquidcms avatar
How to render alternate language page (with paragraphs)?
us flag

I have code running from a hook_node_update which renders the full content so that I can parse the result.

  $view_builder = \Drupal::entityTypeManager()->getViewBuilder('node');
  // Drupal fails to handle language correctly here.. need to fake it out.. ughh!!
  $pre_render = $view_builder->view($node, 'full', $langcode);
  $html = \Drupal::service('renderer')->render($pre_render);
  $dom ...
Score: 2
VardeVim avatar
What is the equivalent of field_view_field()?
mp flag

I am working on some code where I need to get some fields from a node. For the body, I want to display the summary, or the trimmed body if the summary is not there.

I found an example on the web using field_view_field(), which seems to do what I want it to do: return the body field using the summary_or_trimmed formatter. But it seems this is a Drupal 7 thing. I can't seem to figure out what or  ...

Score: 2
Ian T avatar
How can I insert entity or view data into a form?
bz flag

We would like to put our adoption contract online to reduce paperwork, recordkeeping, etc. In order to do so, we need to insert data from an existing entity (specifically the existing record for the dog being adopted) into the contract.

My initial thought was to create a webform: However, there does not appear to be any way to insert field or view data into a webform.
Entityform was my next attempt. Howe ...

Score: 2
Francesco Marchetti-Stasi avatar
How can I test Max-age on cache?
iq flag

I have a Controller using cache tags. I have just been asked a change that requires a Max-age also (show next event starting from current time); I explained that the only way to have this is with some delay, and we agreed for a max-age of 300.

To test the modification on my development machine, I set a shorter max-age of 60,

        return [
            '#theme' => 'mytheme',
            '#my_pa ...
Score: 2
Kevin avatar
How to create configurable plugins under a plugin manager?
in flag

I have a custom plugin type and annotation. The purpose of it is so people can develop their own clients for an API integration, and tell the system which plugin to use to perform these actions. I am able to load all defined plugins and add their sub forms on the main settings configuration form page I have implemented.

When the form submits, I can see the values go through to the appropriate plu ...

Score: 0
Mike Godin avatar
As part of an "update" migration, how do I access an existing entity field in prepareRow()?
us flag

I know I can access the existing entity id through $row->getIdMap()['destid1'], then load the entity via entity_type.manager service, and then access the field. But is there a more direct way of accessing the entity through the migration API?

The closest thing I could find is the entity_value plugin, but it's not clear how I could provide the destid1 value as the source to the plugin.

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.