Latest Drupal related questions

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');
 ...
Score: 0
Yurii Kovalchuk avatar
There were errors validating the config synchronization
cn flag

Locally I deleted custom block "CTA" from custom blocks and block types. Then I exported configs and created merge request. After merge is accepted, the pipeline runs commands on the dev server. And after drush -y cim command I receive the table which shows what configs were deleted and changed and also the next error:

[error] Drupal\Core\Config\ConfigImporterException: There were errors validating  ...

Score: 1
Sending data to custom block
gb flag

I created a module that has several pages of administration. One of these pages is a block creation page. When the block is created the name of the block is kept in the database. The block build() method will return a theme array where the twig file will use the variable to build the markup.

On another admin page there will be a place where the user attaches a block to a certain type of data. Alo ...

Score: 0
Custom theme dependencies
my flag

I have a problem with a custom theme I created on a Drupal 9 test site.

  • Drupal version: 9.3.13
  • Web server Apache 2.4.41 (XAMP win64)
  • PHP version 8.0.11
  • Database version 10.4.8-MariaDB

custom theme professional.info.yml:

name: Professional
type: theme
description: Drupal 9 version of Professional theme
core_version_requirement: ^8 || ^9
base theme: false
version: 1.0.0
libraries:
  - professiona ...
Score: 1
Free Radical avatar
Method getTitle() returns an unexpected value. What causes this?
kz flag

In an implementation of hook_node_insert(), I have the following three lines of code:

dpm($entity, 'entity');
$title = $entity->getTitle();
dpm($title, 'title');

From the first dpm() I get:

entity =>
Drupal\node\Entity\Node {#1632 ▼
  +in_preview: null
  #values: array:27 [▼
    ...
    "title" => array:1 [▼
       "x-default" => array:1 [▼
        0 => array:1 [▼
          " ...
Score: 1
quantumized avatar
Logs full of "page not found" entries for various *.js.map files
ng flag

Our Drupal 9 site is full of "page not found" warnings in the Drupal logs. All entries end in *.js.map (all map files). I cannot figure out where the warnings are coming from (what system is trying to find non-existent map files?) or how to resolve.

See screenshot for examples of not-found files.

screenshot

Score: 0
How to add a top-level link to the Admin menu via the links.menu and routing yaml's
cl flag

Let's say I want to add an additional link to the admin toolbar after Reports such as Groups does.

In my_module.routing.yml I have:

my_module.admin:
  path: '/admin/my_module'
  defaults:
    _controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage'
    _title: 'My Module Stuff'
  requirements:
    _permission: 'access administration pages'

In my_module.links.menu.yml I have:

Score: 2
miststudent2011 avatar
How to check if secondary database definition exists
fr flag

Can anyone please help me on how to check if secondary database is set. If not throw an error.

I am currently defining database connection as below.

Database::getConnection('default', 'sqlite')

I am trying to defining a if , else condition based the database defining.

When I try

if(Database::getConnection('default', 'sqlite')){
  echo success;
}else {
  echo fail;
}

I am getting below error. If  ...

Score: 0
Access FieldItem object from Widget
in flag

I have a custom FieldItem with a method doing a calculation on the field's values:

class MyFieldItem extends FieldItemBase {
  ...
  public function getAmountInEuros() {
    $amount = $this->get('amount')->getValue();
    $currency = $this->get('currency')->getValue();
    $exchange_rate = $this->getExchangeRate($currency);
    return $exchange_rate * $amount;
  }
  ...

I have a custom  ...

Score: 3
Francesco Marchetti-Stasi avatar
Selective cancellation from Watchdog
iq flag

Can I selectively DELETE rows from watchdog? I have annoying errors and warnings I'm slowly getting rid of, but I would like to keep the history of user actions (create, update and delete on content).

I made an experiment on my development environment and I had no problem, I also found somebody around who did something similar and survived – but still, I'd like to be sure that this is legit.

Score: 0
How can Commerce Stores be imported with Feeds?
cn flag

I'm trying to set up a feed to import Commerce store entities.

I installed the Feeds module and the Commerce Feeds module.

I then created a CSV file feed with the following mappings:

  • Name: The store name
  • Email: Store email notifications
  • Currency: Default currency
  • Timezone: Store timezone

However, when I try to import the feed, I get an error:

Address (address): This value should not be null. P ...

Score: 0
How do I import user roles with feeds?
cn flag

I created a CSV file with a column "Roles" and values like role_a, role_b, where role_a is the machine name of the role.

However, when I try to import the role in my feed, I get an error that role_a and role_b do not exist-- but they definitely do exist on my site. How can I import roles?

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.