Latest Drupal related questions

Score: 0
How can we build a view of nodes with their redirect source URLs shown in it?
id flag

I want to build a view of nodes with their redirect source URLs along with node titles. However a direct relationship cannot be established as they do not have a common reference.

Score: -1
Amr.Mohammad87 avatar
undefined drupal_add_js function inside themename_preprocess_page
cn flag

I wanted to use javascript to delete an option from the list of options in case the user is not an administrator and I searched and found this code inside a post and I used it inside the project's themes->mythemename->mythemename.theme file, but that didn't work and I have several problems I want to know how to solve, as I searched a lot I did not find a solution

function mythemename_preproce ...
Score: 2
Bradley avatar
How can I get IntelliSense/Intelephense to look inside a Drupal Docker Container?
kr flag

I am developing a Drupal site using the latest official Drupal/PHP/Apache Docker image.

I have some local directories mapped to inside the Drupal container as expected (modules, profiles, sites, themes).

When I create a module and try to, for example, extend a Drupal class such as BlockBase, I get an error saying BlockBase is undefined. This is because the Drupal core code is inside of the container ...

Score: -1
How can I make Barrio SASS gulpfile coninue watching for changes
eg flag

When running gulp. It runs and compiles SASS one time. How can I adjust the watch so that it continues watching for changes. Do I need to add usePolling: true or usegulp.series. I am following the directions exactly from the Bootstrap 4 SASS - Barrio Starter Kit

My setup: drupal core 9.1.10 bootstrap_barrio 8.x-4.33 bootstrap_sass 8.x-1.13 node v12.22.1 npm 6.14.12 gulp CLI version: 2.3.0 gulp Local vers ...

Score: 0
invalid token: [node:title] when Token module installed
om flag

I'm on Drupal 7.80 and a Drupal newb so help with how to debug as well as things to try appreciated.

Taking over a Drupal install that might have some outstanding issues.

Problem: It looks like 'core' tokens are not available. E.g. [node:title], [current-page:pager], and [site:name] are all unavailable

Detail: When trying to save/preview a custom content type called 'Event' I get a lot of token e ...

Score: 1
Ability to show source url in Content view for nodes who have redirects associated with them
id flag

I have a content view which displays all nodes on the site in a table with fields. Some of the nodes have redirects associated with them, which means that they have a source url associated with them. I need to display the source url along with the other data in the original view table if it exists.

I planned to use view_hook_query_alter to join to the redirect table but it seems that there are n ...

Score: 0
Alexey Uvarov avatar
Drupal 7 taxonomy term fields not handling content filters
au flag

Image Resize Filter doesn't work with taxonomy term description. Resizing works fine in nodes and blocks, but not in views for taxonomy term.

I'm loading term in my view template. And render its description(also tried custom) field.

$term = taxonomy_term_load($term_id);
print render($term->description);

I've tried to render with field_get_items and field_view_field.

Then i've figured out that html ...

Score: 2
How do I know which services.yml is active?
cn flag

If I have multiple services.yml in the sites/default/ directory, how can I determine which one Drupal is actually loading?

Is there a drush command to check this? Or is there some other way to verify which services file is being used by a site?

Score: 0
Automatically have an email sent to page author 11 months after its published date
cn flag

Hello I was wondering if anybody could help.

I'm using Drupal 8 and for every page that exists I need a custom email to automatically get sent to the page author 11 months after that page was published. It's just to act as a reminder to the author that their page is still published incase they have forgot.

I can't find any info online that outlines exactly what i'm trying to achieve however anything ...

Score: 0
manoj kumar Srivastaw avatar
How can I add a dynamic redirect on a 404 hit?
cn flag

I Created a site and URL that returns a 404 Not Found status on www.xyz.com This creates a loss of link equity to the domain and negatively impacts the ability to compete in organic search results.

I wanted to Redirect the URLs returning a 404 status to the defined closest alternative, or parent category, to reclaim link equity from external domains.

Example: Suppose I am using URL http://www.mysite.c ...

Score: -2
Ruzanna Hovasapyan avatar
Diff module shows 'No visible changes' for 'Geolocation' and 'International phone' fields
cn flag

I have "No visible changes" message for 'Geolocation' and 'International phone' fields change and have only one option "Don't compare" in Diff field configuration page /admin/config/content/diff/fields.

Can you help me fix this issue?

Score: 3
How to get all search results of search api index?
kr flag

I want to get all the search results from the search API index and then perform a custom sort on it and then display them accordingly.

I used the hook_search_api_results_alter and also the search results event. My view has a pager to display 10 results at a time.

But the problem is, I am only getting 10 results instead of all because of that pager.

Is there any to get all the results and then perfor ...

Score: 1
Joost avatar
PHP Fatal error: Uncaught ArgumentCountError on Drush run
jp flag

After I updated my site to Drupal 8.9.16 and Drush to 10.5.0 I get the following error PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function when running any Drush command. This only happens on my remote site not on my local site.

The site is still working ok so I was able to clear cache and update the database from the backend of Drupal. I was hoping this would fix the problem bu ...

Score: 0
How can I test code that uses cron for scheduling?
cn flag

I have some custom code on my site that schedules emails to be sent. When an email is set, a user account field is updated. So I want to write a test that:

  1. Jumps forward in time into the future
  2. Runs cron
  3. Checks the value of the email field
  4. Jumps forward in time into the future (and repeats 1-3)

Generally, to advance time in my tests, I'm using the Datetime Testing module, but this doesn't work ...

Score: 0
Grouping in Views jumbles row numbers returned by Result Counter
in flag

Grouping in a View is being used to show a list of items in a table, each row is numbered using Result Counter. However, the View uses grouping which causes the results to be jumbled. See enclosed image.

Any ideas how to renumber the rows correctly, also is there a way list the row numbers in reverse order.

Row numbers from Result Counter are jumbled when Views uses grouping

Score: 0
Berry Dingle avatar
Output of Twig truncated field value sanitezes punctuation characters
cn flag

I output the text of a field in a twig template truncated to 160 characters like:

{% set text = content.field_text.0|render|striptags %}
{{ text|length > 160 ? text|slice(0, 160) ~ '...' : text }}

But when a user enters quotations marks, ampersand and other punctuation characters, they are rendered as

" or &. 

Is there a way to "unsantize" these again, so they are put out the rig ...

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.