Technical Q&A

Entity Reference Display in Views
| 3 min read
In Drupal, the default behaviour of entity reference fields allows us to select unpublished content if the content creator has permission to view unpublished content, which can be useful in specific scenarios where we need to establish relationships even with unpublished content. However, in many cases, we want to refer only to published content. The problem arises when we add references during content creation without verifying whether the referenced items are published. This can lead to confusion later when we wonder why the referenced contents are not visible when viewing the content. Here's a step-by-step guide on how to use a Drupal view to filter the values appearing in an entity reference field
Drupal 10
| 5 min read
entityQuery is one of the most used functions in Drupal. It helps you easily pull Drupal entities in code. But when you use this in contexts other than controllers, say in cron-jobs or update hooks where the system is accessed as anonymous users, it may not work as expected in Drupal 9 Unless you call accessCheck explicitly. This short article talks about how to use entityQuery in these contexts and write entityQuery compatible with Drupal 10.x
MySQL Logo
| 4 min read
From MySQL 5.7 onwards, the error SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column will appear if any non aggregated columns are in the select list, which is not in the group by clause. This article discusses one such use case with Mautic and how we solved it.
Drupal sitebuilding tips
| 6 min read
Agility is at the core of any Drupal site building project. The market changes fast, so the business needs. A Drupal site builder or developer also needs to support the business in this agile environment. This tutorial covers how to solve the error - "There is data for this field in the database. The field settings can no longer be changed."
The website encountered an unexpected error. Please try again later
| 2 min read
"The website encountered an unexpected error. Please try again later." this is the most common error encountered by a Drupal developer. Usually, errors are logged by Drupal and the logs can be accessed from Admin->Reports->Recent log messages. But when you get "The website encountered an unexpected error. Please try again later." you cannot even access the reports dashboard.
Zyxware default image4
| 2 min read
You can always create a view manually, and change the configuration one by one manually. And, all done. But, still, there is a chance of manual error. Drupal9 allows you to import-export views. You can follow the below steps to Import and Export views
Zyxware default image3
| 2 min read
In pre Drupal 8 era, the global variable $user was available every where, from you can easily get the current logged in user id. For all new version of Drupal, you should use \Drupal::currentUser()->id() Once you have the user id, you can use the User::load to get the user object.