AI Assistant
Feature peek | Goran Nikolovski

Drupal CMS

I just tried the new Drupal CMS released today. While I probably won't be using it much myself, I have to say it feels much nicer and far more beginner-friendly compared to Drupal Core.

First impressions:

  • The dashboard is clean and easy to navigate.
  • The sidebar menu is well-organized and intuitive.
Image

Project Browser: The last time I tried this feature, it didn't work for me, but that's no longer the case! I tested installing the Entity API module, and it worked flawlessly. The module installed seamlessly and was properly added to the composer.json file.

Image

Unlike Drupal Core, which only includes two default content types, Article and Basic page, Drupal CMS comes with a wider selection of predefined content types.

Image

Automatic Updates: This module is now included and sounds like a game-changer for non-technical users. I haven't tested it yet, but I'm excited to give it a try soon!

Pre-installed modules: Drupal CMS comes packed with some useful modules. These include Scheduler, ECA, Captcha, Smart Date, Autosave Form, Linkit, and more. A solid foundation for anyone building a site with this version of Drupal!

Image

Here is the complete list of all installed modules. I selected all available content types during the installation process!

add_content_by_bundle
address
addtocal_augment
automatic_updates
automatic_updates_extensions
autosave_form
better_exposed_filters
bpmn_io
captcha
coffee
crop
dashboard
date_augmenter
easy_breadcrumb
easy_email
easy_email_override
eca
eca_base
eca_config
eca_content
eca_misc
eca_modeller_bpmn
eca_render
eca_ui
eca_user
focal_point
friendlycaptcha
geocoder
geocoder_address
geocoder_field
geocoder_geofield
geofield
gin_toolbar
honeypot
jquery_ui
jquery_ui_resizable
klaro
leaflet
leaflet_views
linkit
login_emailusername
mailsystem
menu_link_attributes
package_manager
project_browser
redirect
redirect_404
sam
scheduler
scheduler_content_moderation_integration
smart_date
svg_image
symfony_mailer_lite
token
trash
eca_form
pathauto
selective_better_exposed_filters

AI Assistant: By default, the AI assistant is not installed, but it can be easily installed using the recipe called AI Assistant. Ensure you have an API key ready for OpenAI or Anthropic.

Image

As a test for the AI assistant, I used an example where I add a field to the Blog Post content type that references a taxonomy called Categories. Let's see what creating this field looks like using the AI chatbot.

Overall, it's looking pretty great so far. I'm curious to see how it will be received by Drupal site builders with limited coding experience and those who have never used Drupal before. I hope this project will open doors for greater acceptance of Drupal.

New EntityReference filter for Drupal Views

Drupal 11.1 was released yesterday, and one of the most important things in this release is the addition of a new EntityReference filter for Views.

Before this version, if you wanted to add an exposed filter to an entity reference field — in my case, as shown in the image below, it's the field_related_articles field — the filter would be a simple text input field.

Image

Now, it can be a select box or an autocomplete field, as shown in the second image.

Image

What I don't like is that this filter isn't used by default; instead, you need to write a hook_views_data_alter() for that. In my example, it would look like this:

/**
* Implements hook_views_data_alter().
*/
function MY_MODULE_views_data_alter(array &$data): void {
  $field_name = 'field_related_articles';
  $data['node__' . $field_name][$field_name . '_target_id']['filter']['id'] = 'entity_reference';
}

Read more in the change record.

UI for viewing, reverting and deleting taxonomy term revisions in Drupal 10.3

Taxonomy terms have been revisionable for quite some time now. If you take a look at the change records, you'll see that several years have passed since terms began supporting revisions.

The only issue was that Drupal core did not provide a User Interface (UI) for managing these revisions. However, this changes with the release of Drupal version 10.3, where a user interface for revision management has finally been introduced.

Change record: https://www.drupal.org/node/3396786

Drupal 10.3.0 is scheduled for release in the week of June 17, 2024.

File name sanitization in Drupal 10.2

It's not exactly a feature peak, but it is a new feature in Drupal that is still relatively unknown, so I'm writing about it.

Every time I created a social share image for my blog post in Canva, I had to change the file name after downloading to replace spaces with a middle dash, and convert uppercase letters to lowercase. However, starting with Drupal 10.2, this is no longer necessary. From this version onwards, there is an option for file name sanitization.

You can find this option on the following page: /admin/config/media/file-system.

Image

The file name is changed during the file upload, either through the UI or via REST. For more information, please refer to the change record.

Using PHP attributes for Drupal plugins

Starting with Drupal version 10.2, it will be possible to use PHP attributes instead of annotations for some plugins. Currently, this applies to Action and Block plugins. For more information, please see the following change record:

https://www.drupal.org/node/3395575

Let's take one of my modules, Facets Block, as an example. Here's how the block plugin would look with annotations and with attributes.

Before:

/**
 * Provides a 'Facets Block' block.
 *
 * @Block(
 *  id = "facets_block",
 *  admin_label = @Translation("Facets Block"),
 * )
 */
class FacetsBlock extends BlockBase implements ContainerFactoryPluginInterface {
  ...
  ...
}

After (Drupal 10.2+):

use Drupal\Core\Block\Attribute\Block;
use Drupal\Core\StringTranslation\TranslatableMarkup;

/**
 * Provides a 'Facets Block' block.
 */
#[Block(
  id: 'facets_block',
  admin_label: new TranslatableMarkup('Facets Block')
)]
class FacetsBlock extends BlockBase implements ContainerFactoryPluginInterface {
  ...
  ...
}

To make this work, don't forget to add the appropriate classes (Block and TranslatableMarkup) in the use section and to clear the cache.

Using PHP attributes, rather than annotations that are essentially PHP comments, for adding structured metadata to classes is more appealing to me. So, I definitely plan to use this in the future.

Project Browser

The Project Browser aims to simplify the process of finding and installing modules for both site builders and developers. You've got two options: First, you can use the browser to search for modules and see the necessary Composer and Drush commands for installation. Second, you can actually install modules directly using the UI.

Right now, the module is in beta, and the feature for installing via the UI is still experimental. I gave it a try and encountered some errors, so it seems we'll need to wait a bit longer for it to be fully reliable. That said, the Project Browser is already a handy tool for browsing modules. It's more user-friendly than drupal.org, thanks to improved search and filtering options.

This Project Browser is part of a larger effort to make Drupal more accessible, especially for those who are new to the platform.

Improved field creation in Drupal 10.2

In Drupal, adding fields via the UI can challenge both beginners and seasoned users. Thankfully, Drupal 10.2 is set to offer a more intuitive process with detailed explanations for each field type.

Drupal 9 vs Drupal 10.2 field creation:

This is part of a broader initiative to enhance the field creation experience. For more details, check out the following issue on Drupal: https://www.drupal.org/project/drupal/issues/3346539

Reuse of existing fields in Drupal 10.1

I'm really impressed with the UX enhancements in the recent Drupal 10.1 release, particularly regarding the reuse of existing fields.

On the left is the previous functionality, while on the right you can see the improvements in the latest Drupal 10.1 version.

This is part of a broader initiative to enhance the field creation experience. For more details, check out the following issue on Drupal: https://www.drupal.org/project/drupal/issues/3346539