Planet Drupal

Syndicate content
Drupal.org - aggregated feeds in category Planet Drupal
Updated: 55 min 25 sec ago

Digital Echidna: Thoughts on all things digital: Smart Date 2.0: Let's Do This Again!

Mon, 02/24/2020 - 11:02
The first stable release of Smart Date delivered on my original vision for the module, namely, the need for a more app-like editor experience and intelligent formatting of dates and times in Drupal. And, thanks to feature requests and input from…

Third & Grove: A Sure-Fire Migration Approach to Drupal 8

Mon, 02/24/2020 - 02:27

The key to a successful integration to Drupal 8 is a solid understanding of your Drupal 7 site, so you know what to migrate over and what to avoid. Here’s what you need to know.

GuillaumeDuveau: A security experiment with Fail2Ban, Syslog and Honeypot

Sun, 02/23/2020 - 14:27

Every site has a lot of weekly / daily attempts to abuse your forms to submit their bad content, create users, login... Here we will try to ban some of those IPs directly in the server firewall, so they can't even reach Drupal.

At first, this method might not be applicable for you. If you have a professional hosting / PaaS, your provider could (should ?) already take care of this. At least globally, maybe not specifically for Drupal attacks. For this method, you must have be able to log on your server with a user that has admin rights. This post is especially written for Debian Buster, but it should be more or less the same for other Debian versions. For other distributions, you might have to tweak some things.

Then, as you will see in the conclusion, I tend to think that this method is not sustainable in the long term. This really has to be taken as an experiment.

eiriksm.dev: Creating a Behat step definition with arguments over multiple lines

Fri, 02/21/2020 - 22:39

Here is a quick tip if you want to create a step definition that has an argument with multiple lines. A multiline string argument if you like.

I wanted to test that an email was sent, with a specific subject, to a specific person, and containing a specific body text.

My idea was to create a step definition that looked something like this:

Then an email has been sent to "user@example.com" with the subject "Subject example" and the body “one of the lines in the body plus this is the other line of the body, after an additional line break”

So basically my full file is now this:

@api @test-feature Feature: Test this feature Scenario: I can use this definition Then an email has been sent to "user@example.com" with the subject "Subject example" and the body “one of the lines in the body plus this is the other line of the body, after an additional line break”

My step definition looks like this:

/** * @Then /^an email has been sent to :email with the subject :subject and the body :body$/ */ public function anEmailHasBeenSentToWithTheSubjectAndTheBody($email, $subject, $body) { throw new PendingException(); }

Let’s try to run that.

$ ./vendor/bin/behat --tags=test-feature In Parser.php line 393: Expected Step, but got text: " plus this is the other line of the body, after an additional line break”" in file: tests/features/test.feature

Doing it that way simply does not work. You see, by default a line break in the Gherkin DSL has an actual meaning, so you can not do a line break in your argument, expecting it to just pass along everything up until the closing quote. What we actually want is to use a PyString. But how do we use them, and how do we define a step to receive them? Let’s start by converting our step definition to use the PyString multiline syntax:

@api @test-feature Feature: Test this feature Scenario: I can use this definition Then an email has been sent to "user@example.com" with the subject "Subject example" and the body """ one of the lines in the body plus this is the other line of the body, after an additional line break """

Now let’s try to run it:

$ ./vendor/bin/behat --tags=test-feature @api @test-feature Feature: Test this feature Scenario: I can use this definition # tests/features/test.feature:3 Then an email has been sent to "user@example.com" with the subject "Subject example" and the body """ one of the lines in the body plus this is the other line of the body, after an additional line break """ 1 scenario (1 undefined) 1 step (1 undefined) 0m0.45s (32.44Mb) >> default suite has undefined steps. Please choose the context to generate snippets:

A bit closer. Our output actually tells us that we have a missing step definition, and suggests how to define it. That’s better. Let’s try the suggestion from the output, now defining our step like this:

/** * @Then an email has been sent to :email with the subject :subject and the body */ public function anEmailHasBeenSentToWithTheSubjectAndTheBody2($email, $subject, PyStringNode $string) { throw new PendingException(); }

The difference here is that we do not add the variable name for the body in the annotation, and we specify that we want a PyStringNode type parameter last. This way behat will know (tm).

After running the behat command again, we can finally use the step definition. Let's have a look at how we can use the PyString class.

/** * @Then an email has been sent to :email with the subject :subject and the body */ public function anEmailHasBeenSentToWithTheSubjectAndTheBody2($email, $subject, PyStringNode $string) { // This is just an example. $mails = $this->getEmailsSomehow(); // This is now the important part, you get the raw string from the PyStringNode class. $body_string = $string->getRaw(); foreach ($mails as $item) { // Still just an example, but you probably get the point? if ($item['to'] == $mail && $item['subject'] == $subject && strpos($item['body'], $body_string) !== FALSE) { return; } } throw new \Exception('The mail was not found'); }

And that about wraps it up. Writing tests are fun, right? As a bonus, here is an animated gif called "Testing".

Hook 42: Hook 42 is Headed to Minneapolis for DrupalCon 2020

Fri, 02/21/2020 - 21:51
Hook 42 is Headed to Minneapolis for DrupalCon 2020 Lindsey Gemmill Fri, 02/21/2020 - 20:51

DrupalCon News: Announcing the Sessions for DrupalCon Minneapolis

Fri, 02/21/2020 - 18:34

The accepted sessions for the next DrupalCon are now posted—and what an impressive lineup!

Curated content for the 45-minute sessions is packed with compelling insight, information, and your chance to learn the latest in Drupal. As you look at a session online (such as the one shown below), note its right-hand box with its designated track, tags that further explain its content, the experience level it’s geared toward, and a special button to add it to your DrupalCon schedule! 
 

Ixis.co.uk - Thoughts: Can Drupal be used for mobile apps?

Fri, 02/21/2020 - 09:00
Any website being developed these days is built on top of a responsive framework allowing pages to adapt and re-layout content based on the size of the viewing device.  Perfect for mobile and tablet devices alongside traditional desktop screens.  So why are mobile apps still chased after by people? What’s wrong with their responsive website?

Amazee Labs: Our Next Webinar: Advanced BDD with Cypress

Thu, 02/20/2020 - 17:58
Join us on March 19th for an Amazee Labs Webinar about Advanced BDD with Cypress. 

DrupalEasy: DrupalEasy Podcast 224 - Jacob Rockowitz, Ted Bowman

Thu, 02/20/2020 - 15:23

Direct .mp3 file download.

We talk with Jacob Rockowiz about the Webform variants and A/B testing and Ted Bowman about Drupal 9 info.yml files.

URLs mentioned DrupalEasy News Sponsors Subscribe

Subscribe to our podcast on iTunes, Google Play or Miro. Listen to our podcast on Stitcher.

If you'd like to leave us a voicemail, call 321-396-2340. Please keep in mind that we might play your voicemail during one of our future podcasts. Feel free to call in with suggestions, rants, questions, or corrections. If you'd rather just send us an email, please use our contact page.

The Savvy Few: How to customize the language switcher in Drupal 8

Thu, 02/20/2020 - 15:18

As a creative digital agency based in Amsterdam, we’ve gotten used to having two languages of conduct: Dutch and English. We switch back and forth without even noticing and have learned to read, write and conduct business in both languages effortlessly. Our clients are…

Read more

CTI Digital: CTI goes to Drupal Camp London 2020

Thu, 02/20/2020 - 14:54

Drupal Camp London is a 3-day celebration of the users, designers, developers and advocates of Drupal and its community! Attracting 500 people from across Europe, after Drupalcon, it’s one of the biggest events in the Drupal Calendar. As such, we're pleased to sponsor such an event for the 6th time!

Droptica: Drupal Agency Experts Heading To DrupalCamp London 2020

Thu, 02/20/2020 - 10:24
DrupalCamp London is a great event for all Drupal agencies. It is a conference that brings together hundreds of Drupal experts from around the world. It's a great opportunity to meet people who use, develop, design and support the Drupal platform. Therefore, as usually we will be there this year as well. Droptica is a sponsor of DrupalCamp London 2020 We are proud to sponsor and participate in this year's DrupalCamp London. The event will take place on March 13-15, 2020 in London.

Gizra.com: Form Modes & Wizard Tutorial for Drupal 8

Thu, 02/20/2020 - 01:00

My appreciation for form API in Drupal is on the same level as my attempt to avoid it when it comes to user facing forms. Both are pretty high. The reasons I love it are because it’s extendible and security is built in. I’ve worked with a few other frameworks in different languages, and my impression is that Drupal’s form API is significantly more advanced than any other solution I’ve seen.

The reason I try to avoid it, on the other hand, is mainly because it’s hard to create forms that satisfy the end users, and achieve their expectations. Basically, forms are bulky, and going with a mix of JS/Ajaxy solutions is often a pain. Having a JS form (i.e. some JS widget that builds and controls the entire form), that POSTs to a RESTful endpoint takes more code, but often times provides a more streamlined user experience.

Not sure why and how, but over the years we’ve been tasked quite a few times with creating form wizards. It’s frequently used for more complex registrations, like for students, or alumnus applying for different programs. In the early Drupal 7 days we went with CTools’ wizard, and then switched to Elm (i.e. a JS form) along with RESTful endpoints. Drupal 8 however has one major feature that makes it very appealing to work once more with form API - that is “Form modes.”

This post has an example repo, that you should be able to reliably download and run locally thanks to DDEV. I will not try to cover every single line of code - but rather share the concepts behind our implementation, with some references to the code. The audience is intermediate-level Drupal developers, that can expect to have a good sense of how to use Form modes to build wizards after reading this post and going over the code.

Before diving in, it’s important to recognize that “wizards” come in many flavors. I personally hold the opinion that a generic module cannot be (easily) built to accommodate all cases. Instead, I look at Drupal 8 with its core and a couple of contrib modules as the “generic” solution to build complex - sprinkled with lots of custom business logic - wizards.

Nonprofit Drupal posts: February Drupal for Nonprofits Chat -- Pantheon, NTC Planning

Wed, 02/19/2020 - 22:24

Our normally scheduled call to chat about all things Drupal and nonprofits will happen TOMORROW, Thursday, February 20, at 1pm ET / 10am PT. (Convert to your local time zone.)

This month, in addition to our usual free-for-all, we'll be talking about hosting on Pantheon. There has been a lot of discussion in the community and on the Drupal Slack #nonprofits channel about some of the pricing changes they have implemented. If you would like to discuss and contribute to the conversation, please join us.

We will also have an update on our community's plans for the upcoming Nonprofit Technology Conference (20NTC).

All nonprofit Drupal devs and users, regardless of experience level, are always welcome on this call.

Feel free to share your thoughts and discussion points ahead of time in our collaborative Google doc: https://nten.org/drupal/notes

This free call is sponsored by NTEN.org but open to everyone.

REMINDER: New call-in information -- we're on Zoom now!

  • Join the call: https://zoom.us/j/308614035
    • Meeting ID: 308 614 035
    • One tap mobile
      • +16699006833,,308614035# US (San Jose)
      • +16465588656,,308614035# US (New York)
    • Dial by your location
      • +1 669 900 6833 US (San Jose)
      • +1 646 558 8656 US (New York)
  • Follow along on Google Docs: https://nten.org/drupal/notes
  • Follow along on Twitter: #npdrupal

View notes of previous months' calls.

Lullabot: Drupal 9 Olivero: Turning Conversation into a Core Initiative

Wed, 02/19/2020 - 19:11

One of the biggest benefits of an open-source community like Drupal is the ability to collaborate with fantastic people that you wouldn’t otherwise have the opportunity to work with. However, when you have an idea that you think would be a good initiative for a Drupal core release (such as Drupal 9) you might find yourself thinking: "How do I even begin? How can I advocate for my idea?” We all find ourselves asking these questions as we navigate the complex journey of turning an idea into a core initiative.

TEN7 Blog's Drupal Posts: Mike Gifford of OpenConcept Consulting: Accessibility is a Journey

Wed, 02/19/2020 - 18:59
Summary

Mike Gifford’s mission is to build better and more inclusive software. He’s a Drupal 8 Core Accessibility Maintainer, founder of OpenConcept, an accessibility consulting firm, and all-around gem of the Drupal community. Mike’s been spearheading website accessibility improvements for over a decade, and we’re thrilled to have him on our podcast. You’ll learn a lot from this episode!

Guest

Mike Gifford of OpenConcept Consulting

Tag1 Consulting: Adding Collaborative Capabilities to the Gutenberg Editor with Yjs - Tag1 Team Talk #011

Wed, 02/19/2020 - 17:53
Content collaboration has long been table stakes for content management systems like WordPress and Drupal, but what about real-time peer-to-peer collaboration between editors who need direct interaction to work on their content? The WordPress Gutenberg team has been working with Tag1 Consulting and the community of Yjs, an open-source real-time collaboration framework, to enable collaborative editing on the Gutenberg editor. Currently an experimental feature that is available in a Gutenberg pull request, shared editing in Gutenberg portends an exciting future for editing use cases beyond just textual content.Read more preston Wed, 02/19/2020 - 08:53

ComputerMinds.co.uk: A New Years Resolution for maintaining your Drupal site

Wed, 02/19/2020 - 16:06

So 2020 is in full swing, we are already midway through February and any new year’s resolutions you may have set yourself may have slipped … but why not set yourself a new resolution of keeping on top of your Drupal site maintenance? Even as a developer working with Drupal every day, sometimes you can forget some of the basics in regards to site maintenance, so I’ve detailed some of the most important aspects you should be mindful of below.

Security Core & Contrib updates

Without a doubt, one of the most important things (if not the single most important thing) you can do for your Drupal site security is keeping the site up to date with the latest Drupal Core and Contrib module security updates.

Drupal has a security release window of every Wednesday for Contrib modules and one Wednesday a month (usually the third of the month) for Core updates. It’s important to be aware of the Wednesday release window as more often than not multiple security updates for Contrib modules can be released at the same time, so you might have quite a few updates to apply to your site. For further information on the release window timing, read this article from Drupal.org.

Rather than checking manually, you can subscribe to the security update mailing list through your Drupal.org user account profile so you’ll get notified as soon as the updates are released. At ComputerMinds we have taken this notification process one step further by having tickets raised in our support system automatically based on which modules a site has that need updating.

We created a little module that we have on all our clients' sites, which notifies our issue tracking system which modules the site has enabled. We also have Zapier setup to pull in the updates from the security mail listing, and then tickets are created in our issue tracking system for each site that runs the module in question, so we never miss an update. Neat, eh?

User account audit / Permissions

In addition to security updates for modules and Drupal core, as a site administrator you may want to conduct a user account audit on your site. This could include running through a list of all the user accounts on the site that have administrative privileges, and double checking that all the accounts are still needed, and that there aren’t any users with an elevated administrative role that shouldn’t have one.

In addition to this, you may wish to conduct a review of permissions that each user role has on your site. Check the permissions administration page to see each role and it’s permissions - you’ll want to make sure that no user role has a permission that it shouldn’t have (be especially careful to check the Anonymous role, you don’t want any anonymous user to the site to be able do anything with administration!). Sometimes when a site has quite a few user roles in place and a lot of permissions from contributed modules, the permissions admin page can become hard to read with all roles and permissions displayed on the same page. In this instance it’s usually easier to load up the permissions page for each user role individually and check the permissions that way.

Performance Caching

I’ve briefly touched on some key points on how to boost site performance in a previous article but it is always an important topic to ensure your Drupal site is running smoothly as possible. You’ll want your pages to be served up to people quickly to ensure they have the best possible experience whilst using the site.

For quick wins on any Drupal site, double check that Drupal page caching is enabled and CSS & Javascript aggregation is also enabled. Drupal.org has lots of useful detailed documentation on site performance and what you can do to improve it, so be sure to check it out.

Server PHP Version

Checking what PHP version the web server is running your Drupal site from is important as you may be running an older (probably now unsupported!) version. Upgrading the version of PHP to a newer one is a great way of bringing speed improvements to your site. PHP > 7.0 provides great speed improvements over PHP 5.x and the newest supported version (currently 7.3.x) provides even more performance gains! When Drupal 7 was released it came with support for PHP 5.3.x but as of 1st December 2019, the minimum recommended version for your Drupal 7 site is now 7.2.x

This is because PHP versions prior to 7.2.x are now past EOL (End of Life) so upgrading the version of PHP on your server should be a top priority. Drupal 8 was released back in November 2015 (has it really been that long!?) with PHP 5.5.x support but now that version is not supported at all. At a minimum PHP 7.0.8 could be used but PHP 7.2.x is now the recommended version for any Drupal 8 site. If you can upgrade to PHP 7.3.x though, this will currently provide the best performance improvements.

Performance benchmarking PHP 5.6 - 7.4 - phpbenchmarks.com


Of course, you can’t just upgrade the version of PHP and assume your site will continue to work as it was. You should ensure your Drupal Core version is up to date and you will have to check all the contributed modules that you have enabled on your site for compatibility . Chances are, if you have been running an outdated version of a module, it may be using deprecated or even removed functions that the newer versions of PHP don’t support. 

If a module appears like it’s causing trouble with a newer PHP version, you’ll have to check if there is an update available for the module. Most popular contributed modules should have been updated already to support the recommended minimum PHP versions by Drupal. Apply the update in your development / test environment first, and test it thoroughly. If the module doesn’t have an update available or still isn't working quite correctly, there might be an open issue on the module’s page on Drupal.org with a patch ready that just hasn’t been committed yet. If that isn’t there, then you may need to to write a patch for the module in question to support the newer PHP version. Feel free to get in touch with us at ComputerMinds if you have any modules that need patches written to support newer PHP versions.

A bit of Housekeeping Status report page

An easy way to find out if there are any issues with your Drupal site installation is to check the status report page - /admin/reports/status. This page will give you an overview of your site’s parameters and show any problems that Drupal has detected with your installation. Problems may include: your Drupal Core version being out of date and insecure; file system permissions problems; insufficient PHP memory limit; cron not configured properly and a range of other things.

You should have a good read through of the messages on the status report page and action any errors as soon as possible. The warnings displayed here may or may not be an issue for your particular installation (depending on the warning message) so you’ll need to see if they are actually an issue for your site or not.

Status report page for a Drupal 8 site with an error showing that a security update is required for a contributed module / theme and a warning that Drupal core isn’t up to date with the latest minor version.

 

Module tidy up

As your Drupal site grows over time with more functionality, chances are the site will have quite a large amount of contributed modules enabled. It may be worth checking that you actually do still need all of them enabled, as requirements do change over time and you may have some modules left enabled that you don’t actually need any more. Every extra module that is enabled that doesn’t need to be has the potential to slow your site down, so be sure to have a thorough review of the module list and see if you can get away with disabling any that aren’t used anymore.

Content type tidy up

If your site is a number of years old, chances are it may also have some content types that were used at some point in time but may no longer be used or needed. If you are 100% sure that you can get away with deleting a content type because you don’t have any nodes in place that are built using it and no other functionality relies upon it, then you can delete it from the system. Any fields that were used exclusively by this content type will also be deleted from the database. However, before doing any permanent action such as this it would be a sensible idea to backup your site database first, check that your backup works and that you can actually restore the backup if need be.

Configuration changes

On a Drupal 7 site, you are probably using the Features module to manage configuration and to keep configuration consistent between environments. Over time additional changes may have been made directly on the live site environment without being exported back into code. If it’s not enabled already, the Diff module enables you to easily see what changes there have been in your features between the active configuration on the site and the exported configuration in code. If there are any changes that have been made on the live environment that should be kept, be sure to download the changed feature(s) from live and update the codebase with the changes.

On a Drupal 8 site, you’ll probably be using the lovely built in Drupal 8 configuration management in order to manage your configuration along with Configuration Split to have environment specific configuration in place. Again, the same principle applies here that your live site environment may have configuration changes that you may want to export to your codebase to maintain consistency.

For more information about importing configuration in Drupal 8 without losing changes, check out this excellent article by our very own James Williams.

 

Photo by Kateryna Babaieva

ADCI Solutions: Why is accessibility important?

Wed, 02/19/2020 - 03:29

If you scroll Twitter, Medium or, at least, LinkedIn, you might know that accessibility is a big trend now. Well, we don’t like the word “trend” because web accessibility (a11y) is all about making your website or an app accessible to all groups of users. It doesn’t seem like something extra, right?

In this article, we mostly talk about accessibility in general and mention some of the Drupal accessibility features

Read on. Why is accessibility important?

 

Aram Boyajyan: Applying Drupal 8 patches in composer.json

Wed, 02/19/2020 - 00:57
Applying Drupal 8 patches in composer.json

Sooner or later you will encounter an issue in Drupal core or contrib project that has been fixed but the update has not been included in an official release.

This article explains how to add patches to your composer.json so they get applied whenever you update or install the project from scratch.

superuser Wed, 19/02/2020 - 00:57