LN Webworks: Drupal Coding Standards with Git Hooks: All You Need To Know
Think of good code like a well-put-together puzzle—it's strong, looks good, and is easy to tweak. When you're coding with a team or diving into projects like Drupal, sticking to coding standards is a big deal. That's where Git Hooks come in!
Git Hooks provides a simple and automated way to guarantee that your code consistently adheres to Drupal’s coding standards. By incorporating Drupal Coding Standards with Git Hooks, developers can effortlessly commit and push code that aligns with the community's guidelines.
Let’s dive deeper into the world of Git Hooks to understand how they work and put them into action for smoother and more standardized coding practices.
The Significance of Drupal Coding Standards
Drupal's coding standards encompass a set of guidelines for writing consistent, well-structured, and maintainable code. These standards cover various aspects of code development, including:
ImageX: Tailored Admin Experiences for All Users with The Dashboard Initiative in Drupal
Authored by: Nadiia Nykolaichuk
When logging in to a Drupal website, we all have different goals based on our specific responsibilities. Could each of us have a seamless journey through the admin UI, with no need for any extra steps, and with all the most relevant shortcuts at our fingertips?
Lullabot: Managing Software Updates for Hundreds of Websites
Manually maintaining a Drupal website is time-consuming, especially for a small team with other priorities, like delivering new features and fixing bugs. When the Drupal Security team announces that there is a new security update, this requires one or more members of the development team to:
Four Kitchens: Now’s the time to plan your migration to Drupal 10
Senior Engineer
Primarily a backend developer, Laura also loves adding new cross-disciplinary skills to her collection, such as working with themes and frontend frameworks.
January 1, 1970
If your organization is still using Drupal 7 or later, migrating to an up-to-date platform for your website has been looming like a weight on your shoulders. The move to Drupal 10 isn’t easy. It requires a migration of your site and a full redesign to take advantage of the new tools the latest version offers.
Not only do you need someone to write that migration, but you also need to secure the budget to undertake a project like this. As you wait for the right time to get started, the weight of the deadline to begin your migration to Drupal 10 has only grown heavier. After multiple extensions, the Drupal community has set January 5, 2025 as the final end-of-life date for Drupal 7.
What does that mean for your organization? On the one hand, you now have just over a year to start planning a migration before your site loses crucial support. But on the other hand, as many organizations like yours face a similar deadline, you can’t afford to wait much longer. The time to make the move to Drupal 10 is now.
Why you need to start planning for a Drupal 10 migration
If you’ve fallen behind in migrating your site from Drupal 7, you’re not alone. According to the Drupal community, more than 350,000 projects still use that version of the platform as of November 2023 — one-quarter of all Drupal sites.
As a result, you aren’t just facing a hard deadline to relaunch your new site as January 2025 grows closer. You’re also competing with a vast number of organizations just like yours who need to coordinate the same migration with a web development agency partner. Given that it takes an average of six months to complete the sales process to get started on a Drupal 7 migration, you’re already at risk of missing the deadline if you have not yet contacted an agency.
The longer you wait, the less likely you are to find a team with availability to work with you on a migration plan and website redesign before Drupal 7 reaches end-of-life. And, given the stakes involved, your organization can’t afford the risks of sticking on a platform without the vital benefits of ongoing support.
What your organization loses when Drupal 7 reaches end-of-life
Drupal 7 will reach its end of life 14 years after its initial release. If you’re still on the platform, your website will remain accessible after January 5, 2025. However, it will no longer receive feature updates, bug fixes, or security releases from the Drupal community.
This last detail is most critical to your organization. Any security issues discovered after January 2025 may be publicly disclosed, but Drupal will no longer provide any necessary updates. Prior to the announcement of this final extension for Drupal 7, your organization had the option of paying for extended support. But that is no longer the case.
When you work with the right agency partner, you can create a migration plan that will keep your website secure. Fortunately, your organization will be able to better manage site security after the migration is complete. But that’s just one of the advantages made possible by getting your organization started with Drupal 10.
Drupal 10 offers dramatic advantages after migration
Trusting your site with the legacy code of Drupal 7 doesn’t just expose your organization to poor security. It prevents you from taking advantage of dramatic improvements for your site’s users and content editors.
Improved website speed and SEO performance
Fundamentally, your Drupal 10 website will run faster. Dynamic caching reduces page load times by invalidating only the content that has changed. Instead of needing to reload your entire page after a set amount of time, your cache can just reload the block with new information.
Drupal 10 also marks the end of Drupal 7’s jQuery. A large JavaScript library, jQuery was a powerful tool, but modern browsers perform many of the same functions. The up-to-date JavaScript used by Drupal 10 also decreases page load times.
Drupal 10 also supports new formats such as schema.org, Open Graph, and JSON-LD, which increase conversions from search engines. Plus, Drupal 10 supports advanced accessibility features that improve WCAG compliance and further improve SEO rankings.
Better site security and reduced maintenance costs
Drupal 10 improves your site security by including up-to-date protocols and dependencies such as PHP 8, Symfony 6, and CKEditor 5. As earlier versions of these dependencies reach end-of-life, they may be exposed to unpatched security vulnerabilities. Migrating to Drupal 10 avoids delays in getting critical security patches applied to your site.
One of Drupal’s major advantages as an open-source platform is the community’s Security Team, which delivers security advisories and provides guidance to contributed module maintainers on how to resolve potential vulnerabilities. Providing continued support from the community Security Team for all of your site’s contributed modules beyond the upgrade deadline is critical.
Improved content editing experience and efficiency
Drupal’s out-of-the-box CMS experience has always been limited. With Drupal 10, your site editors benefit from the Claro theme, which makes Drupal much easier to use. New image tools and an updated media library also enable better organization of your site’s assets.
Drupal 10 also includes the JavaScript text editor CKEditor 5, which further simplifies content creation and its accessibility. In addition, the platform offers enhanced translation capabilities in multiple languages, which enables your organization to reach a wider audience than ever.
Don’t wait until an emergency before moving to Drupal 10
Upgrading your site from Drupal 7 to Drupal 10 isn’t quick or easy. That’s why so many organizations like yours have been putting off the migration. But the sooner you start preparing your site for the future, the sooner you can take advantage of all Drupal 10 has to offer.
Better still, you gain the added peace of mind knowing your site won’t be exposed to critical vulnerabilities. And you don’t have to start planning on your own. With the right team of Drupal experts, you can make a plan to ensure your site remains stable and secure moving forward.
If this sounds like a plan that will help your organization move forward, we should talk.
The post Now’s the time to plan your migration to Drupal 10 appeared first on Four Kitchens.
cyberschorsch.dev: Elevating Drupal's Capabilities with Redis for Advanced Data Management
LostCarPark Drupal Blog: Drupal Advent Calendar day 6 - Smart Trim
Welcome back to day 6 of the Drupal Advent calendar. Behind today’s door is the Smart Trim module, and here’s Mark Casias (markie) to tell us all about it.
Smart Trim allows you to control the length of your content by trimming it intelligently. It is designed to be a focused, lightweight improvement over Drupal core’s current formatter trimming capabilities. The maintainers’ focus is stability and ease-of-use. Customizations to the module are encouraged with template overrides and Smart Trim hook implementations.
After installing and enabling Smart Trim, you will see a “Smart trimmed” option in…
Tags
DrupalEasy: Using DrupalPod for core and contrib development
DrupalPod is a browser extension and GitPod configuration that allows Drupal contributors to quickly and easily spin up a personal development environment in their browser without pre-installing anything.
Before we go any further, let's break down some of these concepts a bit more…
GitPod is a cloud development platform - meaning that everything necessary for development is installed in the cloud and the only thing that needs to be installed on one's local machine is a modern web browser. Developers can customize their cloud development environments virtually any way they see fit depending on the nature of their project. GitPod cloud development environments are sometimes called personal development environments, as they are normally created as an alternative to a developer's local development environment.
While GitPod environments will sleep after 30 minutes of inactivity, their current state will not be deleted for 2 weeks (and when pinned, will never be deleted) and can be re-launched via the GitPod Workspaces page.
GitPod is a freemium software-as-a-service with a free tier that includes 50 hours/month of usage.
DrupalPod has two main components - a browser extension (for Firefox and Chrome only) and a set of configuration scripts that customizes a GitPod personal development environment for Drupal core and contributed project (modules, themes, etc…) development.
The DrupalPod browser extension provides a quick way for a Drupal contributor to launch a new personal development environment on GitPod from virtually any Drupal issue queue issue.
The DrupalPod configuration scripts for GitPod include just about everything a modern Drupal development environment needs, including the drupal/core-dev dependencies (which includes PhpStan, phpcs, and PhpUnit), a complete DDEV-based environment, Xdebug setup out of the box, and a useful tool to help set up a temporary ssh keys for using Git to push changes back to issue forks on Drupal.org in a secure manner.
In addition, every DrupalPod environment includes Drush as well as the Admin Toolbar and Devel modules - all with the idea of making it as easy as possible to focus on the task at hand.
DrupalPod was created and is maintained by Ofer Shaal, who also reviewed this blog post and provided answers to my many questions. Thanks, Ofer!
It is important to emphasize that DrupalPod can completely replace one's local development environment for core and contrib development.
Who is DrupalPod for?
DrupalPod is not just for Drupal contributors who write and commit code changes. It also (and possibly more-importantly) allows non-coders to get more involved in the contribution process by making it easy for them to perform common issue queue tasks like testing merge requests (or patches) and reproducing reported issues. It can also be used for user experience and accessibility reviews, among other tasks.
Getting started
There's a few steps that are required before launching a Drupal issue queue merge request in DrupalPod. Luckily, both are relatively straight-forward:
- Install the DrupalPod browser extension in either Firefox or Chrome. Be sure to use the same browser for the remainder of the steps outlined in this article.
- Create a (free) GitPod account and log yourself in through Github.
- Login to your Drupal.org user account.
Note that if you're not interested in making code changes to an existing issue, then the steps marked with an asterisk (*) can be skipped.
Launching a development environment
Next, find an issue on Drupal.org that you'd like to work on. If you're planning on making a commit and pushing it back to the issue fork, be sure to click the green "Get push access" button near the top of the issue.
I've created a test issue in the Markdown Easy module issue queue with an issue fork if you'd like to test DrupalPod on an inert issue. The rest of this article will assume you're testing with this issue.
In your browser, click on the DrupalPod browser extension and you should see the interface shown in the screenshot earlier in this article. You'll see that the project (Markdown Easy) and the issue fork for this issue ("markdown_easy-3403460") are pre-selected. Select the "3403460-drupalpod-test-issue" branch, "10.0.9" for the Drupal core version, and "Standard" for the install profile. Since this issue only contains an issue fork and no patches, the "Choose a patch" dropdown can be left blank.
It should be noted that the options for "Drupal core version" are not automatically updated whenever a new version of Drupal core is released, and there may be a delay before the DrupalPod browser extension is updated with the most recent version of Drupal core as an option.
Then, click on the "Open Dev Env" button and accept the default GitPod configuration settings by clicking the "Continue" button on the GitPod configuration page. By default, GitPod will launch an in-browser version of Visual Studio Code.
Next, GitPod builds your personal development environment using the configuration provided by DrupalPod - depending on several factors, the process to create the environment normally takes just a few minutes. Keep an eye on the terminal output in the Visual Studio Code interface to see when it completes.
GitPod is still setting things up.GitPod is ready to go.
Another big sign that your personal GitPod development environment is ready is when a web browser opens in the Visual Studio Code interface on the development environment's version of Drupal!
To login into Drupal in the GitPod-powered personal development environment use the credentials:
- Username: admin
- Password: admin
What happens if the project doesn't start up cleanly in GitPod?
A fairly common occurrence (especially when working with older issues) is that during the DrupalPod/GitPod setup phase, a Composer error occurs. This is normally not an issue with DrupalPod, but rather with the issue fork (or patch) being out-of-date and in need of update.
Setting up ssh keys for pushing Git commits
This step is not necessary for those just looking to test patches or merge requests and not make code commits.
Hopefully, improved integration between DrupalPod, GitPod, and git.drupalcode.org will soon render this manual temporary ssh key setup obsolete.
At the current time, in order to push commits from a GitPod personal development environment back to a Drupal.org issue fork, a temporary ssh key pair must be set up. While DrupalPod does an admirable job of trying to streamline the issue, there are still a couple of manual steps involved and the process isn't super-smooth.
Luckily, the process is outlined in the "Contribution Guide" document that automatically opens in a DrupalPod environment (see previous screenshot). Step 5 of this guide instructs the user to run a script in the terminal in order to kick off the process of creating the temporary ssh key pair. Currently, the script launches a pseudo-GUI in the terminal app, which leads to the instructions-template.md file being displayed with the necessary steps.
At this point, it is important to click on "< OK >" in the "If you completed the instructions above - click OK" box.
Note that this will kick off a command line task that requires your input, requesting you to enter your desired passphrase for your temporary ssh key (I normally just hit "Return" to leave the passphrase blank). Only once this is step complete will you see your new, temporary ssh public key appended to the instructions-template.md document. After this, proceed with steps 1-9 listed in the document.
Once complete, click to < Exit > the pseudo-GUI in the terminal app, then complete step 10 to confirm that the temporary ssh key is working as expected. I have found that the resulting message is semi-clear at best, but as long as you see "Setup was successful" somewhere in the message, you're probably good-to-go.
At this point, I normally close the ssh-related .md documents open in Visual Studio Code and get to work.
Using Git from inside a DrupalPod environment
One aspect of using DrupalPod that is quite important for anyone interested in code contribution is understanding at least a little bit about how the code base is organized.
Here's the short version - the directory that you should pay the most attention to is repos. This is where the project of interest (the one whose issue fork or patch you're working on) is available to you for editing and (more importantly) for performing Git operations on. DrupalPod uses symlinks to ensure everything is running smoothly, and the repos directory is automatically symlinked to the project of interest (regardless if it is a module, theme, or Drupal core).
When DrupalPod is opened for a Drupal core issue, https://github.com/joachim-n/drupal-core-development-project is used for the code base.
Inside the repos directory is the project of interest. To modify a project file, navigate to the file inside the repos directory. If/when you're ready to make a code commit to the issue fork, you may use the Visual Studio Code's Git GUI or the command line (after navigating to the project inside the repos directory.)
Assuming that you properly set up a temporary ssh keypair from the previous section, you should be able to perform a git push from either interface.
The use of the repos directory is the same regardless of if you're working on a contributed module or Drupal core - the project of interest is in the repos directory.
As a matter of practice, once the GitPod environment is up-and-running, the first thing I do is navigate to the repos/ directory on the command line.
Code quality tools
While Drupal's core-dev dependencies are automatically provided in all DrupalPod configurations, they do not work out-of-the box without some configuration (much like as if you installed them yourself in a local development environment.) Setting up code quality tools like phpcs, PhpStan, and PhpUnit for core or contributed modules involves a little bit of configuration that is out-of-scope of this article. More information is available on drupal.org - this material (and much more) is also covered in DrupalEasy's 15-week Professional Module Development course.
What's next for DrupalPod?
Based on conversations with Ofer Shaal, the primary maintainer of DrupalPod, users can expect the following improvements in the coming months:
- Better integration between DrupalPod and git.drupalcode.org to remove the "temporary ssh key" setup. See https://github.com/shaal/DrupalPod/issues/42 , https://drupal.slack.com/archives/CGKLP028K/p1699418406981909, and https://www.drupal.org/project/infrastructure/issues/3404441.
- Evolution of the DrupalPod browser extension to provide better integration with Drupal issue pages to launch personal GitPod development environments. See https://github.com/shaal/DrupalPod/issues/16.
Tag1 Consulting: A Guide to Estimating Migrations - How Much Will My Drupal Migration Cost? Part 3/3
Hosted by Michael Meyers, - Managing Director of Tag1 Consulting, and Janez Urevc, Sr. Engineer at Tag 1. This podcast series focuses on the strategies involved in upgrading and migrating Drupal websites and applications. This is the last episode in a mini series in which we aim to answer the common question: “How much will my migration cost?” Spoiler alert: It’s complicated. We team up with Lucas Hedding one more time to help demystify the complexities of estimating your project, delving into unexpected variables that could shake up your budget and reveal why quality assurance is more than just a checkbox. Part 1 | Part 2 | Part 3 Please let us know if you have specific migration-related topics you'd like to see us cover. Or, reach out and let us know if we can be an active part of ensuring your migration is a success! --- For a transcript of this video, see A Guide to Estimating Migrations - How much will my Drupal Migration Cost? - Part 3/3. --- Photo by Julia Craice on Unsplash
Read more michaelemeyers Tue, 12/05/2023 - 06:29