Latest Drupal related questions

Score: 1
How to instal Aegir without root access
br flag

The Aegir documentation states that root access is required for installation, but I have seen comments suggesting it is possible to instal without root. If this is correct can anyone point me in the right direction?

Background: I host a few non profit sites with an Aegir service provider who has provided great service. But the sites have grown and the cost has become a challenge for them. I don't ...

Score: 2
sonfd avatar
How can I index arbitrarily related entity data in a Search API index the same as if it were an entity reference?
in flag

I have a site with three content types:

  • Collection (references a paragraph that references Articles)
  • Article (references Authors)
  • Author

I have listing page displays for each of these content types. The displays have facets based on the above relationships.

  • The Collection listing page has a filter by Author. This relationship is not a direct relationship, rather a chain of references: Collection ...
Score: -2
Jiah avatar
Jquery to move field above the table - changes during page refresh
in flag

I have the below jquery code to move a multiselect field and a button above the table.

jQuery(document).ready(function($){
  $('#views-form-resources-block-1 .form-item-ka-types').insertBefore($('#views-form-myblock-block-1 table'));
  $('#views-form-resources-block-1 #edit-actions--2').insertAfter($('#views-form-myblock-block-1 .form-item-ka-types'));
});

In this code I am moving the ka-types field a ...

Score: 3
Renato Francia avatar
Migrating content from live to development environment with Docker
id flag

I'm trying to create a localhost development server with a dockerized drupal 8 environment and need to transfer the content from the live site to localhost.

I have followed the instructions for dockerization here: https://www.drupal.org/docs/develop/local-server-setup/docker-with-solr-integration/docker-configuration

And now I have to migrate the content from the live site into the dev server, and ...

Score: 3
How can I fix the "The specified database connection is not defined: default" error?
cn flag

I installed PHP 7.4.21, then Drupal 9.2.1, and Drush 10.5.0 with Composer as well.

Running Drush without arguments, I get the list of all the available commands.
Running drush cr gives me the following error.

The specified database connection is not defined: default

drush cr --root=/home/ip/d916/web gives the same error.

The output of drush cr -vvv is the following.

Exception trace

at /home/ip/d916/w ...

Score: 0
How do I fix the "You're attempting to access the site via IP address or invalid hostname." error?
cn flag

I'm running Drupal 7 on Pantheon and have started getting the following error message whenever I try to save content.

You're attempting to access a Pantheon site via IP address or invalid hostname. Please use a valid hostname.

I've found a number of related issues online:

Score: 1
khadidja avatar
Display multiple values in separate rows with view that uses Search API
cn flag

Yesterday I asked this question, but after realizing the issue was specific to my view relying on an indexed field using the Search API module I wanted to make another post getting more specific help.

So I have a content type, "Person," that uses an entity reference to assign each person a program. I'm trying to make a "People" page for my site that groups the people by said program that they are in ( ...

Score: -1
Rog Boy avatar
Custom translation function
ma flag

I need own translation function in my custom module where i have defined language codes ('en','ja','de'....etc) Now i just wanted to pass word and language code as a parameter and it returns translation of that word according to language code.

I am trying this inside my translation but it doesn't work it is returning 'yes' instead i don't know why.

 $japanese_value = t('yes', array(), array('langcode' ...
Score: 0
gmak avatar
Use hook_entity_presave to convert multiple lines in a field to separate values in a multi-value field?
cn flag

I have a field defined as 'long text' that allows infinite number of values. The difficulty is that users are entering everything in one iteration of the field. So, I need to get the value they have entered, explode it and create separate multi-value field entries. But... my approach isn't working:

function builder2020_entity_presave(EntityInterface $entity){
  switch ($entity->bundle()) {
    c ...
Score: 0
stckvrw avatar
How to receive menu items in Twig template as array/object?
gb flag

I need to receive (for example by menu machine name) and operate menu items data to use it in Drupal Twig template like:

<ul>
{% for item in items %}
    <li><a href="{{ item.url }}">{{ item.title }}</a></li>
{% endfor %}
</ul>

But I can't find an information on how to do that.

The only thing I've found is like

{% import _self as menus %}
{{ menus.menu_links(items ...
Score: 0
bigboy avatar
Change View head title programmatically
gu flag

I have a view of taxonomy terms with exposed filter. Main view page: site.com/view

I have a text field with 16 different values and urls:

  • site.com/view/1
  • site.com/view/2
  • site.com/view/...
  • site.com/view/16

Depending on passed argument I change View title like this:


use \Drupal\views\ViewExecutable;
function theme_views_pre_render(ViewExecutable $view) 
{
  
  if( $view->id() == 'MY_VIEW_ID' &am ...
Score: 0
Davor Horvacki avatar
How do I set an item definition class for a configuration field?
us flag

I am not able to set an item definition class for a configuration field.

I tried implementing hook_entity_bundle_field_info_alter() , but it doesn't work.

function hook_entity_bundle_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type, $bundle) {
  if ($entity_type->id() === 'my_entity_type_id') {
    foreach ($fields as $field) {
      if ($field->getType() ===  ...
Score: 1
mogio avatar
Example hook_pathauto_pattern_alter
cn flag

I do not understand the hook. I would expect, that "pattern_alter" would allow me to "alter" the "pattern". But this seems to be not the case.

I tried also to alter the alias... which also does not seem to have an effect.

Could somebody show me a working example please?

function xxx_pathauto_pattern_alter(\Drupal\pathauto\PathautoPatternInterface &$pattern, array $context) {

  /* /////////////////// ...
Score: 2
khadidja avatar
Changing how to group by
cn flag

So I have a content type, "Person," that uses an entity reference to assign each Person a Program. I'm trying to make a "People" page for my site that groups the people by said program that they are in (ex. Human Resources, Engineering, Design, etc. etc.)

Screenshot of Grouping By in Drupal View

I've done this by grouping by Program in my View. This then spits out a header for each program in the list. That works just fine! However, some folk ...

Score: 0
pglatz avatar
psr/log requires PHP 8
in flag

I'm running Drupal 8.9.16 with PHP 7.4.12 While attempting to run composer update today I saw this error for the first time:

  Problem 1
    - Root composer.json requires psr/log dev-master -> satisfiable by psr/log[dev-master].
    - psr/log dev-master requires php >=8.0.0 -> your php version (7.4.12) does not satisfy that requirement.
  Problem 2
    - psr/log dev-master requires php &g ...

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.