Planet Drupal

Subscribe to Planet Drupal feed - aggregated feeds in category Planet Drupal
Updated: 7 hours 22 min ago Creating a Behat step definition with arguments over multiple lines

21 February 2020 - 1:39pm

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 "" 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 "" 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 "" 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 "" 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".

Categories: Drupal

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

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

DrupalCon News: Announcing the Sessions for DrupalCon Minneapolis

21 February 2020 - 9:34am

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! 

Categories: Drupal - Thoughts: Can Drupal be used for mobile apps?

21 February 2020 - 12:00am
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?
Categories: Drupal

Amazee Labs: Our Next Webinar: Advanced BDD with Cypress

20 February 2020 - 8:58am
Join us on March 19th for an Amazee Labs Webinar about Advanced BDD with Cypress. 
Categories: Drupal How to customize the language switcher in Drupal 8

20 February 2020 - 6:18am

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
Categories: Drupal

CTI Digital: CTI goes to Drupal Camp London 2020

20 February 2020 - 5:54am

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!

Categories: Drupal

Droptica: Drupal Agency Experts Heading To DrupalCamp London 2020

20 February 2020 - 1:24am
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.
Categories: Drupal

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

19 February 2020 - 1:24pm

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:

This free call is sponsored by but open to everyone.

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

  • Join the call:
    • 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:
  • Follow along on Twitter: #npdrupal

View notes of previous months' calls.

Categories: Drupal

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

19 February 2020 - 10:11am

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.

Categories: Drupal

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

19 February 2020 - 9:59am

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!


Mike Gifford of OpenConcept Consulting

Categories: Drupal

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

19 February 2020 - 8:53am
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
Categories: Drupal A New Years Resolution for maintaining your Drupal site

19 February 2020 - 7:06am

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

Rather than checking manually, you can subscribe to the security update mailing list through your 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. 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 -

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 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

Categories: Drupal

ADCI Solutions: Why is accessibility important?

18 February 2020 - 6:29pm

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?


Categories: Drupal

Aram Boyajyan: Applying Drupal 8 patches in composer.json

18 February 2020 - 3:57pm
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
Categories: Drupal

Specbee: Drupal Paragraphs Module in Drupal 8 - A Complete Tutorial

18 February 2020 - 4:28am
Drupal Paragraphs Module in Drupal 8 - A Complete Tutorial suresh 18 Feb, 2020 Top 10 best practices for designing a perfect UX for your mobile app

Paragraphs is a new way of content creation. It allows the site builders to make things cleaner and can give more editing power to the end-users.
“Paragraphs” is a very popular module in drupal, used for handling content. It is similar to content fields and provides a wide range of options for designs, layout, and grouping of content as per the requirements.

Types of Drupal Paragraphs & Its Usage?

Paragraphs can be of different types. They can be anything from an image to a video, or a simple text to a configurable slideshow. 
Instead of putting all the data in one body field, we can create multiple Paragraphs Types with different structures. This allows the end user to choose between pre-defined Paragraphs Types. By using Paragraphs, we can create multiple featured Paragraphs, allowing the end users to pick the one most suitable for their needs. 
The Drupal Paragraphs module is easily manageable for non-technical users, while also offering Drupal developers the ability to control the appearance of the elements at the theme level.

How to use Drupal 8 Paragraphs module 1. Install and Enable Drupal Paragraphs module.

Drupal Paragraphs module requires Entity Reference Revision module. To work with drupal paragraph module, install and enable Entity Reference Revision module.

2. Create a new Paragraphs Type
  • To take the advantages of Drupal Paragraphs module, create at least one Paragraphs Types.
  • Navigate to Structure > Paragraphs types.
  • Click on “Add paragraph types”.
  • On the next page, there are three fields to be filled.  Label, Paragraph type icon and description. The Label field(mandatory), is the name given to the paragraph type created. If required, icon and the description of the paragraph can be given.
  • After editing, click on “save and manage fields”.
  • In manage fields, click on “Add field”.
  • Here you can add more fields as per the requirement. These fields include text fields, image fields, boolean etc.. This is similar to adding fields in content type.
  • After adding the field, click on “save and continue”.
  • On clicking “save and continue”, you will be guided to the “Field settings” tab. For any of these fields, there are settings such as, maximum length and allowed number of values. This is useful to allow more than one value for some fields when it is required. 
  • Click on “save field settings”.
  • In the next tab we can set the title for the field which is displayed when the new content is created.
  • Then click on “save settings”.
  • Now the field created can be seen inside Paragraphs Types.

3. Add Paragraphs to the content type:
  • Navigate to Structure > Content type. Choose the content type for which the created paragraph is required.
  • Go to “manage fields” of the content type and click “add field”.
  • To use Paragraphs, open the “Select a field type” dropdown list and select “Paragraph” under “Reference revisions”. After selecting “Paragraph” give a label name for the field which is used while creating the content. After labeling, click on “save and continue”.
  • On the next page, there are two settings “Type of item to reference” and “Allowed number of values”. “Type of item to reference” should be set to “Paragraph” and under “number of values”, it is better to set it to “Unlimited” so that we can value innumerable times. Click “Save field settings”.
  • Clicking “Save field settings” will take us to the next tab where there are options to choose the paragraphs type to be used in this content type. If we want a particular paragraph type to be used, check on the paragraph that is required. Else, click ”Save settings” without checking the paragraph types. This will give dropdown during the content creation and we can use any paragraphs that are created.
  • By clicking “Save settings” we can see the field with type entity reference revisions.


4. Adding contents to the content type having drupal paragraphs.
  • Go to Content > Add content, and choose the content type to which paragraph is added.
  • You will see a paragraph field with all the fields added to the paragraphs. There are two more options: They are “remove” and “Add (title of the field referred to the paragraph)”. To add multiple values of the same structure, click on add, and to remove paragraph, click on remove.


Features of Paragraphs module
  1. Allows the editor to create different structures on each page.
    If there are different structures on the same page or different pages, paragraphs can be used. For ex. There is an image with text on the top and slideshow on the bottom. We can use Paragraphs to make this less complicated.
  2. Allows the editor to change the order of the paragraphs.
    If there is a change in display, like there is an image on the top followed by title and description, and you want to change it to title to the top followed by image and description. Such changes can be done using paragraphs easily. 
    Go to “manage display” of the paragraphs used and change the order, which will change the display order of all the content wherever the paragraph is used.
  3. Paragraphs can be nested
    One paragraph field can be referred to in another paragraph field. While selecting field to paragraphs, select “Paragraph” under “Reference revisions” and select which paragraphs type you want to add.

The paragraph module is a very popular module which is used in most of the websites created using drupal. By using paragraphs, end users are asked only to add content as per their requirement and the developers can write the stylings using CSS for displaying the content. The styling and settings are done before adding the content. This makes the content creation easier for both the technical and non-technical users, allowing the content to appear in a consistent manner.  If you are looking to develop a custom module for Drupal or any other Drupal development services, contact us


Drupal Planet Shefali ShettyApr 05, 2017 Subscribe For Our Newsletter And Stay Updated Subscribe

Leave us a Comment

  Shefali ShettyApr 05, 2017 Recent Posts Image Drupal Paragraphs Module in Drupal 8 - A Complete Tutorial Image CSV Import to Migrate Drupal 7 to 8 - A complete guide Image Configuring the Drupal 8 Metatag Module Want to extract the maximum out of Drupal? Contact us TALK TO US Featured Success Stories

Know more about our technology driven approach to recreate the content management workflow for [24]


Find out how we transformed the digital image of world’s largest healthcare provider, an attribute that defined their global presence in the medical world.


Discover how a Drupal powered internal portal encouraged the sellers at Flipkart to obtain the latest insights with respect to a particular domain.

Categories: Drupal

Aram Boyajyan: Drupal 8 add inline JavaScript to a page

18 February 2020 - 3:06am
Drupal 8 add inline JavaScript to a page

Separate JS files are good but in certain cases (e.g. tracking scripts) it might be useful to just add a piece of inline code to a specific page.

This can easily be achieved from a custom module by implementing hook_page_attachments(), checking the page you are on and adding the JS code to the HTML head.

superuser Tue, 18/02/2020 - 12:06
Categories: Drupal Blog: How to improve your time management skills and master your time

18 February 2020 - 1:30am

In this post, I’ll discuss the importance of time management and give you some tips on how to effectively manage your time and get more out of your life. By the end of the post, you’ll be one step closer to having full control over how and where you spend your time.

Categories: Drupal

Tag1 Consulting: What you need to know about Drush 10 & what's coming next

17 February 2020 - 10:06pm
What’s new in Drush 10 - Why Drush over Drupal Console? - The future of Drush: Drush in core? Conclusion In the first part of our two-part blog series on Drush 10, we covered the fascinating history of Drush and how it came to become one of the most successful projects in the Drupal ecosystem. After all, many of us know many of the most common Drush commands by heart, and it’s difficult to imagine a world without Drush when it comes to Drupal’s developer experience. Coming on the heels of Drupal 8.8, Drush 10 introduces a variety of new questions about the future of Drush, even as it extends Drush’s robustness many years into the future. Your correspondent ( Preston So , Editor in Chief at Tag1 and author of Decoupled Drupal in Practice ) had the unique opportunity to discuss Drush’s past, present, and future with Drush maintainer Moshe Weitzman (Senior Technical Architect at Tag1), Fabian Franz (Senior Technical Architect and Performance Lead at Tag1), and Michael Meyers (Managing Director at Tag1), as part of the Tag1 Team Talks series at Tag1 Consulting , our biweekly webinar and podcast series. In the conclusion to this two-part blog series,... Read more preston Mon, 02/17/2020 - 22:06
Categories: Drupal

Promet Source: Yes. The PDFs on Your Website Need to Be Accessible

17 February 2020 - 8:46am
I was recently reading an interesting blog post concerning web accessibility. It seemed insightful and informative, until I came upon a link to “download a PDF …” for more information.  But wait. These PDFs were not accessible. I shouldn’t have been surprised. This kind of thing happens all the time. As the concept of web accessibility enters the mainstream as a “must-have,” the bigger picture is often getting missed.  
Categories: Drupal