Inhalt abgleichen
Drupal.org - aggregated feeds in category Planet Drupal
Aktualisiert: vor 2 Tage 5 Stunden

Drupal.org blog: Single Sign-On is coming to Drupal.org thanks to Cloud-IAM

12. Februar 2024 - 17:46

The Drupal Association is pleased to announce that we have partnered with Cloud-IAM to deploy secure, GDPR-compliant managed KeyCloak for single sign-on for Drupal.org. 

Using single sign-on for Drupal.org identity management has been a long term goal of the Drupal Association, as it offers a number of benefits: 

  • We can more easily manage authentication across our upgraded Drupal 10 sites, and our legacy Drupal 7 sites while we migrate all of our Drupal.org properties.

  • We can begin to introduce 'social login' allowing new users to create their Drupal.org accounts using external identities they already have - making it easier to jump straight in to contribution, as one example. 

  • Once we establish the appropriate terms of service, we can begin to allow Drupal.org users to use their identity to login to external community sites, such as Drupal Camp websites, and use that to federate data back to Drupal.org. 

We know we wanted to implement KeyCloak as our identity and access management solution under the hood, because it is Open Source, robust, and well supported. 

We reached out to Cloud-IAM because they built their company around providing managed services to support KeyCloak as an open source solution to identity management with a strong SLA, and no vendor lock-in. Wherever possible the Drupal Association looks to work with companies that share our Open Source ethos, and are excited to support the Drupal community. 

Being based in Europe, Cloud-IAM is also a privacy-centric service provider, with robust compliance processes for GDPR that also meet or exceed international standards for other privacy regulations such as CCPA, LGPD, etc. 

To our immense gratitude, Cloud-IAM was not only willing to support us, but excited to partner with us to support the Drupal Community and Drupal project. Based on our experience, we would certainly recommend them to all the Drupal agencies and site owners who are looking for their own solutions for managed IAM based on an open source platform.

In fact - CloudIAM would like to offer the site owners and agencies who are looking for their own identity and access management service 10% off, with promo code: DRUPAL10. You can sign up to try the service for free and then apply the discount to a subscription plan of your choice.

So What's Next?

The Drupal Association has partnered with Tag1Consulting to help us build a migration process for Drupal.org users. In the coming month or so we'll be scheduling the migration of our user database. On the Drupal side, we'll be using the OpenID Connect contrib module. 

The majority of your user profile on Drupal.org will stay the same, you will now just see a Cloud-IAM login/registration flow, and use the Cloud-IAM UI for editing some of the core fields for your user account, like name and email address. The rest remains on your Drupal profile. 

When the migration window is scheduled we'll share in the #drupal_infrastructure channel on Drupal Slack, and repost to our usual drupal_infra social media channels.

Kyle Einecker|True Summit: Search Web Components Alpha 2 Release

12. Februar 2024 - 17:21
A few weeks ago, I announced the Search Web Components module, and since then, I've seen a lot of interest and gotten some great feedback on the module's state and where it could go from here. I've also been doing a lot of work to improve the site builder experience and stabilize config structures and patterns to help avoid breaking changes moving forward. Here's a look at the improvements included in the Alpha 2 release

The Drop Times: Life as a Drupal Storyteller: A Journalist's Perspective

12. Februar 2024 - 16:19
Curious about life as a journalist for Drupal? Step into the world where every day brings new stories, connections, and insights. From interviews with community members to crafting engaging articles, it's a dynamic journey of discovery and collaboration.

Hey there, Drupal Fam!

Wanted to drop you a line and share a bit about what it's like to be a journalist here in the heart of Drupal. It's not all flashy headlines and breaking news, but it's rewarding in its special way.

So, picture this: every day, I'm diving deep into the world of Drupal, connecting with community members, and getting the scoop on all the latest happenings. Whether it's chatting with developers, designers, or contributors, there's never a dull moment.

One of the valuable aspects of my role is connecting with Drupal community members for interviews. These engagements offer valuable insights and perspectives, enriching our understanding of the community and its contributions.

And let's not overlook the articles. We have some fantastic content lined up for you. From insightful analyses to thought-provoking pieces and event coverage, we consistently bring fresh and engaging material.

But here's the thing – it's not just about churning content. It's about doing justice to Drupal and all the incredible work being done by our community members. Their contributions make a difference, and I'm honoured to play a small part in showcasing their talents.

So, next time you're scrolling through our articles or tuning in to one of our interviews, remember – thanks to the Drupal community's amazing folks who make it all possible.

An organizational update: We are now active on Drupal Slack as #thedroptimes. Do search for the handle and join Slack, where you can participate in the process of news gathering by occasionally answering our queries or sharing your perspectives. 

Now, let's talk about some important news stories we covered from last week:

Automated Testing Kit for Drupal, led by André Angelantoni, revolutionizes end-to-end testing with its versatile features, impactful vision, and seamless integration of Cypress.io and Playwright frameworks. Andre is the project lead of the Automated Testing Kit, Layout Builder Kit, and Campaign Kit. He speaks with Alka Elizabeth in an email correspondence about the project.  

Nicolas Loye, CTO of Smile, a French Drupal agency, and the treasurer of Drupal France, shares insights with Elma John in an interview on community-driven growth, financial stewardship, and fostering collaboration. From porting projects to organizing Drupal events, Nicolas reflects on the essence of community work and its impact on his role as a technology leader.

Jorge Lopez-Lago, a seasoned Solutions Architect at FFW, shares his diverse experiences and insights in another exclusive interview with Elma. Jorge offers a glimpse into his evolution from a hands-on Drupal developer to a multifaceted leader and discusses his unique approach to problem-solving and community engagement.

Get the latest update from FOSDEM as Drupal, Joomla, Typo3, and WordPress join forces to establish the Open Website Alliance, representing over 50% of websites online.

The Drop Times is thrilled to announce its official media partnerships with DrupalCamp Rennes and Drupal Developer Days Burgas 2024! Stay tuned for exclusive coverage of these premier Drupal events, featuring insights, interviews, and live updates.

Discover the latest in Drupal and web technologies with Dries Buytaert, founder of Drupal, as he visits Japan for the first time in nearly eight years. This exclusive event on March 14, 2024, in Tokyo, promises valuable insights into the future of web development.

Get ready to save $100 on DrupalCon Portland tickets! Early bird registration is now open. Join the City of Roses for networking, collaboration, and learning with the Drupal community. Register now! Drupal Association introduces scholarships for historically oppressed communities and community grants to support vital Drupal contributors at the upcoming DrupalCon Portland 2024. Eligible individuals can seize this opportunity to engage in the conference and contribute to the Drupal community.

Dive into the heart of Drupal MountainCamp as a volunteer! Join in welcoming attendees, ensuring smooth sessions, and making this event unforgettable. Your contributions will be rewarded with drupal.org credits. Drupal Mountain Camp announces Acquia as its latest Gold Sponsor, adding substantial value to the upcoming event.

DrupalCamp Ghent 2024 invites professionals and experts to submit session proposals for its upcoming event, offering a platform to share insights with the Drupal, PHP, and JavaScript communities.

Beginning July 1, 2024, Drupal.org will discontinue patch testing and DrupalCI testing, mandating a shift to GitLab CI for automated testing. Contributors must switch from patches to merge requests by the specified date, marking a significant transition in the platform's testing framework.

We acknowledge that there are more stories to share. However, due to constraints in selection, we must pause further exploration for now.

To get timely updates, follow us on LinkedIn, Twitter and Facebook. Also, join us on Drupal Slack at #thedroptimes

Thank you,

Sincerely
Kazima Abbas
Sub-editor, TheDropTimes.

Gábor Hojtsy: Onwards to Drupal 11 - ways to get involved

12. Februar 2024 - 13:52
Onwards to Drupal 11 - ways to get involved

Last November the Drupal project announced that Drupal 10 will receive long term support until mid-late 2026. That is when Drupal 12 will be released, so this long term support does not mean that Drupal 11 will not be released as well in the meantime. And by meantime, I mean Drupal 11 will be released this year, in 2024, in June or July or December.

Gábor Hojtsy Mon, 02/12/2024 - 13:52

mcdruid.co.uk: What is overriding your Drupal config?

12. Februar 2024 - 13:32

Something is overriding config in Drupal - you can see it by invoking drush with and without the flag to include overrides:

$ drush cget system.performance | grep -B1 preprocess css: preprocess: false -- js: preprocess: false $ drush cget --include-overridden system.performance | grep -B1 preprocess css: preprocess: true -- js: preprocess: true

Perhaps we want to turn this config off, but these overrides won't let us.

Where are these config overrides coming from?

Generally, overrides can come from two places - for example, see:

https://git.drupalcode.org/project/drupal/-/blob/10.2.3/core/lib/Drupal/Core/Config/Config.php#L280

// Apply overrides. if (isset($this->moduleOverrides) && is_array($this->moduleOverrides)) { $original_data = NestedArray::mergeDeepArray([$original_data, $this->moduleOverrides], TRUE); } if (isset($this->settingsOverrides) && is_array($this->settingsOverrides)) { $original_data = NestedArray::mergeDeepArray([$original_data, $this->settingsOverrides], TRUE); }

There could be an override in settings(.php) or perhaps it's coming from a module. How can we tell which?

The settingsOverrides and moduleOverrides properties of the config object are protected, but in modern PHP there's at least one trick we can use to have quick look at them.

$ drush ev "var_dump((fn() => \$this->moduleOverrides)->call(\Drupal::config('system.performance')))" NULL $ drush ev "var_dump((fn() => \$this->settingsOverrides)->call(\Drupal::config('system.performance')))" array(2) { ["css"]=> array(1) { ["preprocess"]=> bool(true) } ["js"]=> array(1) { ["preprocess"]=> bool(true) } }

So we can tell that these overrides are coming from settings as opposed to modules.

Hopefully that'll help us track them down.

Tags: drupal-planetdrupaldebugging

LN Webworks: How To Manage Custom Drupal Migrations Using SQLBase?

12. Februar 2024 - 13:05

Drupal 9 stopped getting updates on November 1, 2023. Drupal 7 will stop getting updates by January 2025, but that's the last extension. Drupal 10 came out in December 2022, and the latest version, 10.1.6, was released on November 1, 2023. What does this mean? 

There’s a lot going right now in the drupal space and many websites are migrating to updated versions of Drupal. In fact, as of now, over 12,000 websites have already switched to Drupal 10, as per the Upgrade Status module download stats. This simply means that now is the best time for you to opt for a Drupal migration company and make the move. Let's have a look at the various ways to migrate in Drupal, with a special focus on custom migrations using the SqlBase source plugin.

Gábor Hojtsy: Looking for your input for DrupalCon Portland 2024 initiative highlights

12. Februar 2024 - 11:50
Looking for your input for DrupalCon Portland 2024 initiative highlights

I have the pleasure to organize the DrupalCon initiative keynotes now twice a year. The genius idea of this I believe came from Angie Byron, and ever since we include them, they are among the top rated sessions at each DrupalCon. The goals of this keynote are manyfold. First, we want to show the people who lead important work in core, humanising the software.

Gábor Hojtsy Mon, 02/12/2024 - 11:50

The Drop Times: Nicolas Loye: Bridging Technology and Community for Sustainable Growth

9. Februar 2024 - 22:59
Uncover the journey of Nicolas Loye, CTO at Smile and a Drupal luminary, as he shares insights on community building, leadership, and staying at the forefront of technology. Discover the blend of technical expertise and community stewardship that defines his impactful role in the Drupal ecosystem.

Ramsalt Lab: Upgrading your site from Drupal 9 to 10

8. Februar 2024 - 15:44
Upgrading your site from Drupal 9 to 10 Perry Aryee Developer 08.02.2024

With Drupal 9 having reached its end of life (EOL) on November 1, it’s time to start planning for an upgrade.

For those already operating on Drupal 9, upgrading to Drupal 10 is not as daunting as earlier upgrades and promises to be easy, reflecting the software’s overall trend towards smaller, more incremental upgrades and faster iterations. According to Drupal, you should "completely update your Drupal 9 site to the most recent version of the modules and theme(s), before updating to Drupal 10." 

The deprecated code will be based on Drupal 9 moving into Drupal 10, but there are ways to search your system and update the specified code block.

The first thing to do is to install the  drupal/upgrade_status module in your project and enable it. composer require drupal/upgrade_status && drush en upgrade_status, if you have drush installed else go to admin > modules  and search for upgrade status and install it. After the module is enabled, go to Admin > Reports > Upgrade Status. This page should contain all the upgrades and code changes necessary before your site can be upgraded to Drupal 10.

Steps to upgrade Drupal 9 to Drupal 10

Migrating from Drupal 9 to Drupal 10 can be easy or can be difficult depending on the project you are involved in. Yes, because every site is different and may present its own unique challenges.

These are the following steps to migrate from Drupal 9 to Drupal 10.

  1. Keeping your custom modules up to date with new standards and removing deprecated code will result in small changes before you have to do a major core upgrade. If the site is well maintained the changes are mostly with the core_version_requirement. You will need to update from core_version_requirement: ^9 to core_version_requirement: ^9 || ^10 . As soon as we are sure that our custom code is compatible with Drupal 10, we can move to check the contrib modules. And this is where things might get tricky
  1. Upgrade contrib modules to versions which support Drupal 9 and 10. If the new version only supports D10, then you can add it to composer as an alternative version, for example: 'drupal/module_name': '^1 || ^2', and you can have version 1 still installed while on Drupal 9. Once you install Drupal 10, version 2 of the module will be installed by composer.
  1. Uninstall obsolete modules and themes like Color, RDF, Seven etc. You can’t remove core modules or themes, but if you are not sure if these are depended upon, it can be moved from core to contrib especially classy and stable, which you can keep as contrib modules. You may need to set your Admin theme to Claro and re-export your config on this step. Use drush theme:uninstall theme(s) command (drush thun for short) to uninstall themes.
  1. Remove orphaned permissions which are still assigned to user roles. Export your config before starting this step. The upgrade_status module will tell you which permissions need to go from which roles. Simply edit the user.role.[role].yml config ymls and remove the relevant lines from the permissions array. 
  1. Upgrade Drupal core to latest 9.5, in order to upgrade to 10.

composer require drupal/core-recommended:^9.5 drupal/core-composer-scaffold:^9.5  --update-with-all-dependencies

Now let's look at the tricky part. Drupal 10 has some specific things we have to do to allow us to upgrade to drupal 10.

  1. Drupal 10 runs with PHP 8.2 or later so make sure you have it to be able to upgrade. 
  1. Not all modules are Drupal 10 ready so you will have to use drupal lenient.  You will have to get a patch for Drupal 9 only modules. Install mglaman/composer-drupal-lenient before attempting to upgrade. Otherwise these modules will create a dependency problem. After the installation, you need to declare the Drupal 9 modules which should be treated as Drupal 10 modules. For example, to allow drupal/token to be installed run:

composer require mglaman/composer-drupal-lenient

composer config --merge --json extra.drupal-lenient.allowed-list '["drupal/token"]'

  1. If you have Drush installed make sure the version is ^11 || ^12, we use this because some module may not be version 12 compatible.
  1. Drupal Console (drupal/console) is not Drupal 10 compatible and as such we have to remove it. 

composer remove drupal/console --no-update

  1. Upgrade CKEditor 4 to CKEditor 5,if you have custom CKEditor 4 plugins which don’t have an upgrade path to CKEditor 5, then you can keep using CKEditor 4 but as a contrib module. You may have to use it although it is deprecated, to avoid errors when you deploy the Drupal 10 upgrade, when the config import tries to uninstall CKEditor.
  1. If you use Entity Embed, you need to manually replace CKEditor Embed buttons with SVG icons as Drupal 10 is not using png.
  1. Check custom code for core/jquery.once if it does exist update it to use core/once because jquery.once is removed from Drupal 10
  1. If you encounter dependency issues, and composer just won’t let you upgrade to D10, but you are sure that all the dependencies are in order, then the quickest thing to do is to delete the composer.lock file(although its not a best practice), delete vendor folder then run composer install which will install from the composer.json file and create a new .lock file.
  1. Note that you can ignore some false positives such as an empty custom profile, which phpstan can’t scan, and as such upgrade status would complain, the trick would be to create an empty .php file to get the issue fix

After all these are done and ready for upgrade, you can run this command

composer require 'drupal/core-recommended:^10' 'drupal/core-composer-scaffold:^10' 'drupal/core-project-message:^10' --no-update

If   drupal/core happens to be part of the composer.json file, remove it. This dependency is included in drupal/core-recommended and may cause problems. If you have drupal/core-dev installed, you can run this

composer require 'drupal/core-dev:^10' --dev --no-update

Now,let us test perform the update with the --dry-run option: this allows us to see if the update will runs smoothly or might encounter some errors.

composer update --dry-run

If you encounter any errors, walk through the process to resolve them. Resume the process when the errors are resolved, run the update with dependencies to update any transitive module.

composer update -W

Don’t forget to run drush updb and drush cex after the upgrade. This means you should run the upgrade on top of an installed and functioning D9 database.

If you have a custom theme that is  based on classy,seven or stable then don’t forget to install them as  contrib themes - composer require 'drupal/[module_name]'. You should uninstall and remove upgrade status after the upgrade process.

Pathauto has an issue with some config files so, if you have Pathauto installed then you need to update some configs by hand. Namely pathauto.pattern.[name] config files have had their selection_criteria plugins updated. For example node_type becomes entity_bundle:node. or  try the following command

drush eval 'include_once(DRUPAL_ROOT . "/modules/contrib/pathauto/pathauto.install"); pathauto_update_8108()'

In summary the whole update process for a site can be very difficult and ranges from project to project. It could have different modules installed, with some even locked to specific dev versions, as well as heavily patched old major versions of modules which needed to be upgraded. You walk through these steps and iterate through if need be to get your upgrade completed.

The Drop Times: André Angelantoni Discusses Automated Testing Kit Module

8. Februar 2024 - 15:44
Discover how the Automated Testing Kit for Drupal, led by André Angelantoni, revolutionizes end-to-end testing with its versatile features, impactful vision, and seamless integration of Cypress.io and Playwright frameworks.

PreviousNext: Handling Emails Asynchronously: Integrating Symfony Mailer and Messenger

7. Februar 2024 - 21:54

Take advantage of Symfony Mailer’s first-class integration with Symfony Messenger brought to Drupal via the SM project, allowing your site to send emails asynchronously.

by daniel.phin / 8 February 2024

This post is part 6 in a series about Symfony Messenger.

  1. Introducing Symfony Messenger integrations with Drupal
  2. Symfony Messenger’ message and message handlers, and comparison with @QueueWorker
  3. Real-time: Symfony Messenger’ Consume command and prioritised messages
  4. Automatic message scheduling and replacing hook_cron
  5. Adding real-time processing to QueueWorker plugins
  6. Making Symfony Mailer asynchronous: integration with Symfony Messenger
  7. Displaying notifications when Symfony Messenger messages are processed
  8. Future of Symfony Messenger in Drupal

Since Swift Mailer and its Drupal contrib integration were recently deprecated, many projects have naturally switched to its replacement: Symfony Mailer, either via Drupal Symfony Mailer or Drupal Symfony Mailer Lite.

This post outlines how you can take advantage of Symfony Mailer’s first class integration with Symfony Messenger brought to Drupal via the SM project. This integration allows for dispatching emails off-thread, potentially improving performance of the dispatching (usually web-) thread by offloading email-related tasks to dedicated Symfony Messenger workers. This setup can be considered an alternative to using Queue Mail.

Setup

As of writing, of the two Symfony Mailer implementations in contrib, Drupal Symfony Mailer Lite has built in support for Symfony Messenger. Drupal Symfony Mailer does not yet support it, an issue and merge request exist to add it. Apply a patch until the changes are merged.

Symfony Messenger itself does not require any special configuration, other than installing SM.

To run asynchronously, the \Symfony\Component\Mailer\Messenger\SendEmailMessage message must have routing configuration to a transport. Or at least the fallback transport must be configured. Without transport configuration, Emails will still be dispatched through Messenger, however they will be executed synchronously in the same thread they were dispatched.

Opting out

If you happen to have both Symfony Mailer and Symfony Messenger installed but do not want emails to be sent asynchronously, you can configure routing for the \Symfony\Component\Mailer\Messenger\SendEmailMessage message to instead use the synchronous transport.

If you’re using the SM Config submodule:

Sending emails and dispatching emails

Emails may be dispatched using the usual Drupal mechanism, or you can dispatch using Symfony Mailer directly by constructing an email object:

$email = (new \Symfony\Component\Mime\Email()) ->to('jane@example.com') ->from('john@example.com') ->subject('Hello world!') ->text('Some sample text.') ->html('<p>some <strong>sample</strong> text.</p>'); /** @var \Symfony\Component\Mailer\MailerInterface $mailer */ $mailer = \Drupal::service(\Symfony\Component\Mailer\MailerInterface::class); $mailer->send($email);

After the send method is executed, Mailer checks Messenger is available, creates a new SendEmailMessage message to wrap the \Symfony\Component\Mime\Email object. Then dispatches SendEmailMessage to the messenger bus.

As is typical with Symfony Messenger, email messages must be serialisable. Avoid including any Drupal entities or service references in an email object, and render email contents before sending it.

Processing emails

To process email messages, run the worker with sm messenger:consume. This command will either listen or poll for messages and execute them in a dedicated thread, ensuring quick processing after they are dispatched. For more information on the worker, please refer to post 3 of this series.

In the next post, we’ll explore how to add a user interface to notify users when relevant tasks have been processed.

Tagged Symfony, Symfony Messenger, Symfony Mailer, Email

mark.ie: Show the last author of a node in the Drupal content list

7. Februar 2024 - 16:40

Instead of showing the original author of a node, show the last person to edit it.

Droptica: The Future After Drupal 7. Join Our Free Droptica Webinar

7. Februar 2024 - 14:32

Support for Drupal 7 will end next year. If you're running your website on this version of the system, now is a great time to figure out what to do with it. Is upgrading to Drupal 10 a good idea? And how about choosing other technologies to migrate your site? Join our free webinar on February 22nd to discover your options as Drupal 7's end-of-life becomes a reality.

LN Webworks: Must-Know Features Of Webform Module For Drupal 10

7. Februar 2024 - 11:51

The Webform module works as a form of builder and submission manager within the Drupal framework, offering a wide range of levels of flexibility and ease for site builders. This tool empowers website creators to efficiently develop a range of forms, with the added benefit of default settings for quick implementation. Delving into its impressive features, the Webform module is known for its user-friendly interface. Users can swiftly create forms using default configurations or take advantage of the module's customization options to tailor forms to precise specifications.

Beyond this, the Webform module boasts a suite of powerful features, making it a core asset of the Drupal ecosystem. But there’s more to it. Let’s have an overview of the most important features and functionalities of the Webform. 

Brian Perry: Extending The Drupal API Client

7. Februar 2024 - 2:00

import RadCallout from '../../../components/rad/RadCallout.astro';

As a result of our Pitch-burgh funding, the current focus of the Drupal API Client is to create a fully featured client for Drupal's JSON:API implementation. Even with that goal, we've focused on making our work extensible for other API formats in the future through the implementation of an ApiClient base class. Functionality that could apply to any API client is added to the base class, while anything specific to JSON:API is added to the JsonApiClient class (which extends ApiClient.)

Recently, we have been working on adding Decoupled Router support to our JSON:API Client. I found this implementation to be a great example of the extensibility of the library, so I wanted elaborate on it in a blog post for those who may want to extend the API Client in the future.

The existing JsonApiClient has the following method to retrieve data for a resource:

await client.getResource('node--article', '3347c400-302d-4f6c-8fcb-3e74beb002c8');

Ideally, users of Decoupled Router could also get an identical response by resolving a path:

await client.getResource('/articles/give-it-a-go-and-grow-your-own-herbs');

To achieve this, we first needed to provide a way to reliably get data from Decoupled Router.

The Decoupled Router Endpoint

With the module enabled, Decoupled Router exposes an endpoint with the following structure:

/router/translate-path?path=<path>

Given a path like /articles/give-it-a-go-and-grow-your-own-herbs the endpoint could provide a response similar to:

{ "resolved": "https://dev-drupal-api-client-poc.pantheonsite.io/en/articles/give-it-a-go-and-grow-your-own-herbs", "isHomePath": false, "entity": { "canonical": "https://dev-drupal-api-client-poc.pantheonsite.io/en/articles/give-it-a-go-and-grow-your-own-herbs", "type": "node", "bundle": "article", "id": "11", "uuid": "3347c400-302d-4f6c-8fcb-3e74beb002c8" }, "label": "Give it a go and grow your own herbs", "jsonapi": { "individual": "https://dev-drupal-api-client-poc.pantheonsite.io/en/jsonapi/node/article/3347c400-302d-4f6c-8fcb-3e74beb002c8", "resourceName": "node--article", "pathPrefix": "jsonapi", "basePath": "/jsonapi", "entryPoint": "https://dev-drupal-api-client-poc.pantheonsite.io/en/jsonapi" }, "meta": { "deprecated": { "jsonapi.pathPrefix": "This property has been deprecated and will be removed in the next version of Decoupled Router. Use basePath instead." } } }

While easy to make sense of, this response technically doesn't follow the JSON:API spec, which prevents us from using our existing JSON:API Client without modification. We could write a small amount of custom code in JsonApiClient to fetch and handle data from this endpoint, but this case is exactly what our ApiClient base class is intended for. With a similarly small amount of code we can extend the ApiClient class to add only what is unique to the Decoupled Router endpoint, while getting access to all of the features of the base class at the same time.

So rather than writing code specific to JsonApiClient, we decided to create a new DecoupledRouterClient class that our JsonApiClient could then make use of.

Extending ApiClient

For the sake of example, a simple Decoupled Router client could look like this:

// DecoupledRouterClient.ts import { ApiClient, type ApiClientOptions, type BaseUrl, } from "@drupal-api-client/api-client"; export class DecoupledRouterClient extends ApiClient { constructor(baseUrl: BaseUrl, options?: ApiClientOptions) { super(baseUrl, options); const { apiPrefix } = options || {}; this.apiPrefix = apiPrefix || "router/translate-path"; } async translatePath(path: string) { const apiUrl = `${this.baseUrl}/${this.apiPrefix}?path=${path}`; const response = await this.fetch(apiUrl); return response.json(); } }

In our constructor, the only modification we need to make is the default value for the API prefix. While the base class doesn't have a default, Decoupled Router uses router/translate-path. Now when instance of DecoupledRouter is created without this option, it will use the default.

We then define a translatePath method that:

  • Takes a path of type string
  • Uses the fetch method provided by the base class to make a request to Decoupled Router
  • Returns a promise with the provided json data

Using an instance of this class would look something like:

// main.ts import { DecoupledRouterClient } from "./DecoupledRouterClient.ts"; const decoupledRouterClient = new DecoupledRouterClient("https://dev-drupal-api-client-poc.pantheonsite.io"); const translatedPath = await decoupledRouterClient.translatePath( "/articles/give-it-a-go-and-grow-your-own-herbs" );

<RadCallout>Check out this code sandbox for a live version of the example above.</RadCallout>

Taking Advantage of Additional ApiClient Features

With this example we already have a functional client, but quite a bit more is possible using the features of the ApiClient class we extended. For example, We can already make authenticated requests using any of the supported authentication methods:

// main.ts import { DecoupledRouterClient } from "./DecoupledRouterClient.ts"; const decoupledRouterClient = new DecoupledRouterClient("https://dev-drupal-api-client-poc.pantheonsite.io", { authentication: { type: "OAuth", credentials: { clientId: "client-id", clientSecret: "client-secret" } }, }); // API requests will now be authenticated const translatedPath = await decoupledRouterClient.translatePath( "/articles/give-it-a-go-and-grow-your-own-herbs" );

Our example Decoupled Router client could be updated to take advantage of built in caching, logging, or locale support. For example, the following modification would allow us to make use of the defaultLocale option if our Drupal site supports multiple languages:

// DecoupledRouterClient.ts import { ApiClient, type ApiClientOptions, type BaseUrl, } from "@drupal-api-client/api-client"; export class DecoupledRouterClient extends ApiClient { constructor(baseUrl: BaseUrl, options?: ApiClientOptions) { super(baseUrl, options); const { apiPrefix } = options || {}; this.apiPrefix = apiPrefix || "router/translate-path"; } async translatePath(path: string) { // If it exists, incorporate the default locale // into the apiUrl const apiUrlObject = new URL( `${this.defaultLocale ?? ""}/${this.apiPrefix}?path=${path}`, this.baseUrl, ); const apiUrl = apiUrlObject.toString(); const response = await this.fetch(apiUrl); return response.json(); } }

Routing is a common problem, so we've added a fully featured getResourceByPath method to our latest @drupal-api-client/json-api-client release. We've also published the Decoupled Router client as a standalone package for anyone who wants to use it separately.

While the caching functionality of the client can lessen the impact, getResourceByPath still makes multiple API calls for uncached data, which leaves room for improvement. We could optimize this in the future by providing support for the subrequests module. That is yet another client for a type of Drupal API that could use the ApiClient base class as a starting point.

We're closing in on the 1.0 release of @drupal-api-client/json-api-client. If you’re interested in contributing, check out our project page on Drupal.org, and join us in the #api-client channel on Drupal Slack.

PreviousNext: Adding real-time processing to QueueWorker plugins

6. Februar 2024 - 21:52

Projects no longer need to rely on unpredictable processing time frames. The SM project can intercept legacy Drupal @QueueWorker items and insert them into the Symfony Messenger message bus, effectively giving existing core and contrib queue workers jobs real-time processing capabilities.

by daniel.phin / 7 February 2024

This post is part 5 in a series about Symfony Messenger.

  1. Introducing Symfony Messenger integrations with Drupal
  2. Symfony Messenger’ message and message handlers, and comparison with @QueueWorker
  3. Real-time: Symfony Messenger’ Consume command and prioritised messages
  4. Automatic message scheduling and replacing hook_cron
  5. Adding real-time processing to QueueWorker plugins
  6. Making Symfony Mailer asynchronous: integration with Symfony Messenger
  7. Displaying notifications when Symfony Messenger messages are processed
  8. Future of Symfony Messenger in Drupal
QueueWorker plugins

@QueueWorker plugin implementations require no modifications, including the method of dispatch, data payload, or the processItem . The data payload must of course be serialisable. Fortunately, most QueueWorker plugins already comply since their data is serialised and stored to the queue table. As always, avoid adding complex objects like Drupal entities to payloads.

Runners

With queue interception, the sm command can be solely relied upon. Legacy runners such as Drupal web cron, request termination cron (automated_cron.module), and Drush queue:run will be rendered inoperable since they will no longer have anything to process. Consider decommissioning legacy runners when deploying queue interception.

Setup

Queue interception is a part of the primary SM module. Adding a single line in settings.php is the only action required to to enabling this feature:

$settings['queue_default'] = \Drupal\sm\QueueInterceptor\SmLegacyQueueFactory::class;

SM module will need to be fully installed before this line is added. Consider wrapping the line in a class_exists(SmLegacyQueueFactory::class) to enable in a single deployment.

Existing per-queue backends

Setup may be more complex if projects are utilising per-queue backends or anything other than the default database backend for queues, such as Redis. In that case, carefully evaluate whether to convert all or specific queues to use Symfony Messenger.

Whether per-queue backends are utilised can be determined by looking for queue_service_ or queue_reliable_service_ prefixed items in settings.php.

Routing

@QueueWorker jobs are converted to \Drupal\sm\QueueInterceptor\SmLegacyDrupalQueueItem messages in the backend. Knowing this class name allows you to configure transport routing. If routing for this message is not explicitly configured, it will naturally fall back to the default transport, or execute synchronously if there is no routing configuration.

Running the jobs

As usual, when a transport is configured, all you need to do is run sm messenger:consume to execute the tasks. The worker will either listen or poll for messages, and execute them in a very short amount of time after they are dispatched, in a dedicated thread. More information on the worker can be found in post 3 of this series.

The next post covers how Drupal emails can be dispatched to messages, so the web thread can execute faster.

Tagged Symfony, Symfony Messenger

Drupal Core News: DrupalCI and all patch testing will be turned off on July 1, 2024

6. Februar 2024 - 21:16

To continue automated testing, projects must convert to GitLab CI and contributors must switch from patches to merge requests by July 1, 2024.

As of July 2023, contributed projects are fully equipped to adopt GitLab CI. In October 2023 we announced that Gitlab CI testing of Drupal core was already five times faster than the legacy DrupalCI system. In our December 2023 maintainer email we announced that our legacy DrupalCI will be retired as soon as July 2024. Now we are announcing further details.

What's happening?

Some DrupalCI features are already turned off

Projects without DrupalCI testing configured cannot add it anymore. Direct access to log output and artifacts on DrupalCI is no longer available. Results are still summarized on the Automated Testing tab of those project's pages.

With the exception of Drupal 7, it is not possible to run tests on patches against Drupal core anymore. Even for Drupal 7, patches need to be sent for testing manually.

Changing DrupalCI schedules ends on April 30, 2024

After April 30, 2024, DrupalCI schedules can not be added or changed, except to remove DrupalCI testing. Tests will keep running with existing configured schedules until removed.

DrupalCI and all patch testing will be turned off on July 1, 2024

No DrupalCI tests will be executed after this date. It will also no longer be possible to run tests on any patches on Drupal.org on any project. Existing test results will be kept for six months.

All results from DrupalCI tests will be removed on January 1, 2025

This is the end of DrupalCI data retention. No testing results will be available beyond January 1, 2025.

What to do about it? Most projects can start GitLab CI testing with a provided template .gitlab-ci.yml

Using GitLab CI for testing may seem intimidating at first but the Drupal Association engineering team and a number of community volunteers have spent a lot of time to make it as easy as possible for you to adopt GitLab CI for testing.

There is a preconfigured .gitlab-ci.yml template that will set up everything you need to test your project. This template has several useful features, including a variables file that will be automatically updated by the Drupal Association, to make sure you’re always testing against the currently supported versions of Drupal.

Most project maintainers won’t have to make any changes to the template, just commit the template to your project and your testing should work right away!

Set up GitLab CI for your drupal.org project today.

Contributors must use merge requests on all projects to get automated testing after July 1, 2024

GitLab CI, like almost all modern CI systems, is designed to test merge requests. If you have ever contributed to a project on GitHub, you pretty much already know how it works. The advantage of Drupal.org merge requests is that they are collaborative by default, so you and fellow contributors can work in the same fork.

Read the best practices for contributing through merge requests.

ImageX: Drupal Calendar Creation Unleashed: Useful Modules And A Step-by-Step Walkthrough

6. Februar 2024 - 19:31

Authored by: Nadiia Nykolaichuk.

One of the earliest known calendars was created by ancient Egyptians, who used hieroglyphics and carvings to represent the months, days, and important events. Today, visually appealing and user-friendly calendars are easily created on websites, all thanks to powerful CMSs like Drupal. We’ll share some modules in Drupal that are available for calendar creation and management, and carefully walk you through the key steps of building a calendar. 

DrupalEasy: Why you should care about using settings.local.php

6. Februar 2024 - 17:14

Teaching folks why a settings.local.php file is an important part of setting up a personal development environment is so important to us here at DrupalEasy that it is a foundational part of both of our long-form Drupal training courses.

While preparing for an upcoming podcast mini-series I've been invited to participate in with the Talking Drupal folks, I'll be mentoring someone who is looking to re-enter the Drupal development scene after missing out on Drupal's transition from its pre-Symfony days. One of the tasks I have outlined for this person is to set up a settings.local.php file. When I went to find a good resource for the "why" and the "how", I came up empty. I couldn't find a single, up-to-date resource that conveyed what I feel is important.

So, that's what this blog post is all about. 

Why use settings.local.php?

Using a settings.local.php is all about configuring your local development environment for a project to be as useful to you, the developer, as possible. Default settings in this file do things like force all errors to the screen and disabling some of the (but not all) Drupal caches.

This file also pulls in the sites/development.services.yml file which contains some useful service class parameters and overrides - again, things that are useful for local development.

Setting up a settings.local.php literally takes less than two minutes, and when I see a Drupal developer struggling to figure out a white-screen-of-death error on their local environment, I can't help but ????

In addition to adding Drupal's core-dev dependencies and the Devel module, enabling the settings.local.php file is literally one of the first things I do when setting up a new site.

How do I enable the settings.local.php?

I'm so glad you asked.

Step 1

Copy sites/example.settings.local.php to sites/default/settings.local.php. Use a user interface (like the MacOS Finder) or the command line - it doesn't matter.

cp web/sites/example.settings.local.php web/sites/default/settings.local.phpStep 2

Uncomment the conditional include for settings.local.php in your sites/default/settings.php file - it looks like this:

# if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) { # include $app_root . '/' . $site_path . '/settings.local.php'; # }

Uncommented, it looks like this:

if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) { include $app_root . '/' . $site_path . '/settings.local.php'; }Step 3

There is no step 3. This blog post is complete. 
 

Tag1 Consulting: Gander Automated Performance Testing - Video Demo with Catch

6. Februar 2024 - 15:41

In this second part (check the first part!) of our Tag1 Team Talk on Gander, the new Automated Performance Testing Framework integrated into Drupal Core, we get a live demo from Nat Catchpole (aka. Catch), the lead developer on the project. Nat takes us on a tour through this high-impact tool developed by Tag1 in collaboration with the Google Chrome Team, showing you how you can get up and running with automated performance testing for your projects. Gander is poised to significantly impact Drupal's user experience, performance and Core Web Vitals by creating visibility into how Drupal performs on the front and back end. Catch shares his expert insights into the development and application of Gander and shows how easy it is for developers to start extending and using this today on their projects! Whether you're a Drupal developer looking to improve your project's performance or simply curious about the latest in Drupal technology, this episode offers valuable knowledge and practical advice on getting your Drupal website to perform optimally. With discussions on Gander's immediate benefits and future potential in the Drupal community, this episode is a must-watch for anyone interested in taking their projects to the next level...

Read more Mariano Tue, 02/06/2024 - 05:41