Planet Drupal

Subscribe to Planet Drupal feed
Drupal.org - aggregated feeds in category Planet Drupal
Updated: 6 hours 58 min ago

Valuebound: Safety concerns in an E-Commerce site and how Drupal is addressing it

6 April 2018 - 2:40am

The advances in technology has brought in an unprecedented growth in E-Commerce industry, which has become a major target for cyber crimes. Thus, it becomes necessary to address the security measures for websites as any data breach leads to the loss of sensitive information along with monetary losses. This not only threatens reputation of the organization but also leads to mistrust among customers. When compared to leading organizations, smaller firms are affected more as they have to suffer substantial losses.

 Full security over the web can’t be attained as the hackers are devising new plans everyday to access consumer data. But, threats can be minimised by following certain…

Categories: Drupal

Amazee Labs: The Zuerich.com Filter Pages based on React and Drupal 7

6 April 2018 - 12:28am
The Zuerich.com Filter Pages based on React and Drupal 7

We recently relaunched the updated front-end for Zürich Tourismus. In this blog post, I want to highlight some user experience improvements that we added to the existing Drupal 7 website using React. Enter the Zuerich.com filter pages.

Josef Dabernig Fri, 04/06/2018 - 09:28

The Zuerich.com filter pages are highly interactive and allow the site visitor to explore data in a synchronized list & map view. We also applied the same concept to the different filter pages for Accommodation, Events and Restaurants.

Instant, Client-Side filtering

A key improvement to the filter pages is that they allow users to quickly explore and filter the data. The filter section immediately updates the corresponding results list according to the selected criteria. This works well for datasets below 1000 items, which are all accessed together and filtered using React on the client-side.

In traditional Drupal implementations, we would have the entire page reload for every filter click event, or, if we were to use AJAX, the entire results section would reload and require a round-trip to the server which slows down the user experience. With the new React-based approach, we were able to greatly improve the interaction speed. The search box also instantly filters the items for every character that the user enters.

Proximity Filtering

A really cool feature on top of the instant client-side filtering is the “Nearby me” search. It allows the user to either select their own geolocation or select from some popular points of interest. For tourists that aren’t yet familiar with the city, being able to choose between various important locations, such as the Zurich airport or main station, helps in their orientation.

When a point of interest has been selected, the map instantly switches to “Filter list by map” mode which only displays the results that correspond to the current map window. As the user zooms in or out, the map automatically updates the results list.

Keeping Multiple Viewports in Sync

Keeping multiple viewports easily in sync is one of the main advantages of using React to implement the filter pages. The state of the dataset and filters can be managed centrally and will automatically update the different views, such as the filters themselves, the results list as well as the markers on the map. By moving around the map, the user is also able to filter the list results to show only what is available in the current viewport which helps narrow down their search geographically.

Unlimited, Interactive, React-based Filter Pages

The Zuerich.com filter pages are built using React components within the existing Drupal 7 infrastructure that drives the main website. We fetch the data from the backend using custom JSON feeds and render the filters, the results lists and map views using React. By doing so, we significantly improved the actual and perceived performance of the user interactions with the filters and map view. The same concept has been applied to different parts of the website. There are many more of these filters pages in addition to the ones used for Accommodation, Events and Restaurants.

In the back-end, the content editors are able to create custom filter pages using a special Content Type form. Filter settings and sort or proximity search options are able to be configured accordingly. In the React-based front-end, we then show the adjusted set of filter options and adjust the list views slightly i.e. to show star ratings for hotels.

Categories: Drupal

OSTraining: Getting Started With Drupal's Webform Module

5 April 2018 - 10:31pm

One of our club members have asked us how to create a survey form in Drupal 7. They wanted to achieve this without a need for custom coding.

The Webform contrib module is the perfect tool for the job. In this tutoral, you will learn how to use this module to survey what peanut butter, jelly and bread your site visitors prefer.

Categories: Drupal

Agiledrop.com Blog: AGILEDROP: Drupal business sessions you don't want to miss at DrupalCon Nashville

5 April 2018 - 6:43pm
There will be a lot of sessions at DrupalCon Nashville. That's nothing new to be fair. DrupalCons are the biggest Drupal events with the most Drupal session, so you can’t attend all of the sessions you would want to. Therefore, we have made a short list of the business sessions you don't want to miss. We sure won't.    Think Your Website is GDPR Compliant? Think Again! Thursday, April 10 Mark Shropshire, Open Source Security Lead at Mediacurrent   On May 28, 2018, GDPR will come into force - that is a data security legislation, which allows individualists to control their personal data… READ MORE
Categories: Drupal

Stanford Web Services Blog: Welcome to Stanford Drupal Camp 2018!

5 April 2018 - 3:41pm

Stanford Drupal Camp 2018 is already upon us!

The ninth annual Stanford Drupal Camp will be hosted at the  Stanford Law School on April 6-7, 2018.

https://drupalcamp.stanford.edu/

Categories: Drupal

Metal Toad: Drupal 8: Consumption of a Third-Party API

5 April 2018 - 1:33pm
Drupal 8: Consumption of a Third-Party API Marcus Bernal Thu, 04/05/2018 - 20:33

For a recent project, we were tasked to consume the client's internal data from a custom API. Now, this scenario was lucky for us, the API provides a total item count of about 5000, but when queried with a start date, it provides all revisions of items between then and now. The premise was that the data was to be downloaded at regular intervals, so that content editors didn't need to copy and past to keep product information up to date.

Categories: Drupal

Acro Media: Drupal Commerce 2: How to Add, Edit and Delete Coupons

5 April 2018 - 7:45am

 

Drupal Commerce 2 comes with promotions sub-module that lets you manage store promotions in so many different ways. One common promotion method is to give your customer coupon codes. Coupon codes "unlock" a specific deal for the customer. For example, if you're trying to get a customer to complete an abandoned cart, you may offer a coupon code for 20% off the entire order to try and push them. Maybe you have a weekly newsletter and you want to reward your subscribers with a deal just for them. A custom coupon code with a discount is a great way to do this.

In this Acro Media Tech Talk video, we user our Urban Hipster Commerce 2 demo site to show you just how easy it is to create a promotion and assign a coupon code to it. We'll also show you how you can set additional conditions so that the coupon is only available to use when the conditions are met.

Its important to note that this video was recorded before the official 2.0 release of Drupal Commerce, and so you may see some differences between this video and the current release. The documentation is also evolving over time.

Urban Hipster Commerce 2 Demo site

This video was created using the Urban Hipster Commerce 2 demo site. We've built this site to show the adaptability of the Drupal 8, Commerce 2 platform. Most of what you see is out-of-the-box functionality combined with expert configuration and theming.

More from Acro Media Drupal modules in this demo

Categories: Drupal

Drupal Association blog: Global Training Days Survey Results

5 April 2018 - 7:17am

Last year one of the big topics for the Drupal Global Training Days (GTD) Working Group was sorting out what exactly we can do to help with organizing these events. To that end, we sent out a survey to learn more about the kinds of events that people doing GTD events run, or have offered in the past, and how the community can help. We got 33 responses to the survey and 9 of those fine folks also hopped on a phone call with us (myself (add1sun), Mauricio (dinarcon), or Marina (paych)) to talk about the survey answers in more depth. While it's been a little while since we conducted the survey and interviews, we figure this is really interesting and useful information to share with the community.

The first section of this post covers the questions we asked and the results on the survey. The second section dives into our takeaways from the interviews we conducted after the survey.

Survey Results What is your motivation for organizing GTD?

Far and away the most common motivation for running GTD events is to grow the local Drupal community, with over 90% selecting this as at least one reason. The second biggest motivation (39%) was to promote a company or organization, which was then followed up equally at 24% with finding new hires or new clients.

Is your company sponsoring your time to prepare and present the training?

For this question, about 60% of respondents have their company cover their time. There was also a mixed bag of people who are their own business or who freelance, where counting company versus personal time is a blurrier line, as well as people who straddle both, doing some of the work on the clock and the rest on their own time. 21% of those surveyed stated that they are not supported by a company for GTD events.

In which country (and city) have you organized a GTD?

Our list from the survey covered 36 events in 18 different countries, plus an online course with attendees from all over the world.

  • Argentina
  • Australia
  • Bolivia
  • Brazil
  • Cameroon
  • Canada
  • China
  • Costa Rica
  • France
  • India (5)
  • Italy
  • Japan
  • Mexico (3)
  • Moldova
  • Romania
  • Russia
  • Slovakia
  • South Africa
  • United States (11)
In which languages have you organized GTD?

23 (64%) of events are being offered in English. There were 12 languages other than English in the list, with Spanish taking the number 2 slot with 6 events, which lines up with the number of events in Spanish-speaking countries.

Given the wide range of countries, it is a little surprising that there is definitely a concentration of events that are offered in English.

What materials do you use to present the training?

This was split almost evenly between those that use materials they created themselves and those that use a combination of existing materials and their own.

What topics have you covered in the trainings you have presented?

113 responses (with multiple select) indicated almost everyone covers more than 1 topic, and the vast majority of those topics are introductions to Drupal and getting started. Of the topics presented:

  • 94% cover What is Drupal?
  • 85% do Site Building
  • 70% cover the Drupal Community
  • 51% do Theming
  • 42% do module development.

From the results to this question it is clear that most GTD events do not stick with just one broad topic.

What format do you usually follow?

The most popular format (76%) is to have the instructor do a live demonstration and have the students follow along. Next in line is to only give presentations, and the least popular was to have the instructor do a live demo but not have the students work on the project. There were also a couple of people who use recorded videos and then offer Q&A and support to the students as they work through them.

How long does the training last?
  • 36% give full day workshop
  • 24% give half-day workshops
  • 30% do a mix of the 2 formats.
How many people attend your event on average?

Event size was interesting. Over 50% of events had 11-20 attendees. Smaller groups, from 1-10 came in second around 27%, and only 21% of events had more than 20 attendees.

Choose the statement that fits you most with regards to venue cost

Just over a third of respondents have given events at different free venues, while 21% have access to a permanent free venue to use. 30% have used both free and paid venues. Only 1 person has a permanent paid venue they use for GTD.

What type of venues do you use?

Most events use either a company office or a university/educational facility, with conference spaces and co-working/community spaces making up much of the rest. There were also a range of locations from coffee shops to libraries included.

What is the attendee capacity of your venue?

Compared to the class sizes mentioned above, there is certainly space for bigger groups overall, with 60% of venues capable of accepting over 20 attendees.

If you organize GTD in a paid venue, how much does it cost on average? (Use local currency)

For those who do pay for venues, the costs are all over the place, which makes sense given the huge range of locations (both world location and venue type) for these events. The most expensive came in around $400 USD or ~325 EUR.

Which of the following does your venue provide?

Most venues (88%) provide a good internet connection, and a projector with screen. 21% of the venues provide computers to use. Others noted extras they get with their venues include things like parking, snacks, and coffee.

Interview Results

We also spoke to 9 people from 5 countries to dig into what they're doing and how the community and GTD Working Group can help. While everyone has different struggles and needs, there are a few common themes that come through.

Organizing and Marketing

There was a wide variety of needs around organizing and marketing GTD events. This included things like matching up people who like to teach with people who can organize and market the event (many times people don't really want to both!), and there was definitely a repeated request for marketing materials and guidelines for groups to help promote their events. There were also some interesting ideas like creating badges for trainers and attendees, as well as having better ways for GTD organizers and trainers to share information, either through online knowledge bases or in-person events, like GTD-focused activities at DrupalCons.

Curriculum

Not surprisingly curriculum and course materials came up for a lot of people. As we saw from the survey results, a lot of people create their own materials, often through need, not because they necessarily want to. There was a common thread of requests for workshop agendas, slides, and all kinds of training materials, centrally located so that people could more easily build a workshop without investing a lot of curriculum time. A number of people also pointed out that not having materials in the local language was a problem, and is time-consuming work to translate existing materials.

Infrastructure

The last main theme that we saw was about the technical and venue needs. This ranged from funding for space to hold GTDs, having a standard way to get students set up with a local environment, and having a regular way to collect feedback on events, and be able to share that information.

While the GTD Working Group certainly can't tackle all of these things, this gives a good starting point for the biggest pain points that the community can address to accelerate GTDs and the adoption of Drupal. If there are particular topics or initiatives in here that you would like to help with, please reach out to the working group to get connected with others and see what resources are available to help.

Categories: Drupal

CTI Digital: The Release of Drupal 8.5 (What’s New and What’s on the Horizon)

5 April 2018 - 6:38am

Drupal 8.5 was released on the 7th of March 2018 with a host of new features, bug fixes, and improvements. There are plenty of exciting updates for developers in this blog. Or if you're a business owner, click here to find out what this means for you.

Categories: Drupal

OPTASY: How to Set Up Google Analytics on Your Drupal Site: A Dead-Simple Step-by-Step Guide

5 April 2018 - 6:04am
How to Set Up Google Analytics on Your Drupal Site: A Dead-Simple Step-by-Step Guide admin Thu, 04/05/2018 - 13:04

Let me guess: it's for “luring” online visitors that you've built your Drupal site! For attracting traffic, which would then turn into leads/retail sales/customers... you name it. Yet, without an efficient web analytics service, you're just firing at the target... blindfolded. And so, why not go for the best? Especially since it's free and there's even a dedicated Drupal module streamlining... everything. Here's how you integrate Google Analytics into your Drupal site.

Who are your visitors? Where do they come from? And what do they do precisely during their visits on your Drupal site? How long are their visits? What content on your site do they linger on and what content do they “stubbornly” ignore? Needless to say that for getting your answers to all these questions you need to set up Google Analytics on your website.

Since:

Categories: Drupal

roomify.us: Tutorial: building a simple event approval workflow Drupal 8 & BEE

5 April 2018 - 4:59am
BEE makes it easy to quickly implement all kinds of booking & reservation use cases. We've created a new video that walks you through setting up BEE to handle event reservations with a moderation workflow:
Categories: Drupal

Drop Guard: Drop Guard’s Showdown with SA-CORE-2018-002

5 April 2018 - 3:30am
Drop Guard’s Showdown with SA-CORE-2018-002

A lot of Drop Guard users faced their first Highly Critical SA-CORE-2018-002 update within the PSA-2018-001 release last week. We interviewed a bunch of them and want to share Drop Guard’s performance with you. This means that we will share its achievements, its flaws and its “should have performed better”.
 

The Good

Until today, Drop Guard performed 7370 updates for Drupal agencies and their clients all around the globe.

Drupal 8 Drupal Drupal Community Drupal Planet Security Update
Categories: Drupal

myDropWizard.com: Get FREE help from a "Wizard" at DrupalCon Nashville!

4 April 2018 - 11:53pm

We're trying something new this year at Drupalcon 2018! Book some time with a myDropWizard "Support Wizard" for some FREE help with your Drupal site!

You're a first time Drupalcon attendee? You're a veteran Drupaler? Either way, you made part of your Drupalcon mission to fix a lingering issue - or at least to be pointed in the right direction!

We're here to help!

We spend our days helping Drupalers just like you every day with their support needs, so we thought "Let's bring that myDropWizard Support Face-to-Face with Drupalers: FOR FREE!"

So, drop by Booth #818 or (better yet!) schedule with us below!

Categories: Drupal

Hook 42: Community in Harmony - Hook 42 gives back at DrupalCon Nashville

4 April 2018 - 8:09pm

DrupalCon is one of the most exciting Drupal events all year, especially for those of us who enjoy working in the community. We really get to shine.

This year is no different. It’s nice to share knowledge through presentations, but there are many ways to give back to the Drupal Open Source project.

Categories: Drupal

Colorfield: Drupal 7 to Drupal 8 migration with configuration entities

4 April 2018 - 11:38am
Drupal 7 to Drupal 8 migration with configuration entities christophe Wed, 04/04/2018 - 20:38 The migrate system is stable since Drupal 8.5.0, so this is a great time to review the migration tools provided by the community. This post does not cover migration from the UI, it focuses on partially customized migration that are runned with Drush. In most cases, you will probably want to review the content model a bit (you know, that content type or field machine name that does not actually reflect the truth since its creation, ...). The idea behind is to delegate the heavy lifting to Migrate Upgrade for migration template generation, then apply content model changes if needed.
Categories: Drupal

TIP Solutions: Why a critical security hole is actually not so bad?

4 April 2018 - 9:28am
First (before the problem)

If you have a Drupal site and this is the first time you hear about the critical vulnerability published on March 28 2018 read the two last chapters immediately.

During the last week in the Drupal community around the world there has been a hustle about the security hole which was named DrupalGeddon2 [1] [2]. This vulnerability was "highly critical" and got many people scared - unnecessary. This post tries to explain when the vulnerability will become a problem? When the vulnerability is actually not a problem and how to handle the situation right. 

DrupalGeddon DrupalGeddon2 tietoturva Planet Drupal
Categories: Drupal

Dropsolid: How we installed a Drupal security patch on 1300 sites, stress-free!

4 April 2018 - 8:28am
04 Apr How we installed a Drupal security patch on 1300 sites, stress-free! Nick Veenhof Drupal

Yesterday a highly critical security issue in Drupal was released. The issue itself is considered critical, because, the way we understood, it makes it possible to execute code as an anonymous user. This could lead to a complete hack of your site and complete exposure of your content - or, worse, if your webserver is badly configured, a full-scale hostile takeover of your server. (More background info available here and here.)

The issue was announced to the Drupal community a week early, so our Dropsolid team had plenty of time to anticipate and prepare. Currently, Dropsolid serves 482 unique and active projects, which contain on average three environments. To be more precise, this gave us a whopping 1316 active Drupal installations to patch. These environments are located on 65 different servers. 45 of those servers are out of our hands and are managed by other hosting companies, such as Combell or even dedicated hardware on site with the customer. At Dropsolid we prefer to host the websites within our own control, but to the Dropsolid Platform this ultimately makes no difference. For some customers we also collaborate with Acquia - these clients are taken care of by Acquia’s golden glove service.

So, back to preparing to patch all the different Drupal installations. We would be lying if we said that all Drupal installs were running on the latest and greatest, so we used Ansible and the Dropsolid Platform to gather all the necessary data and perform a so-called dry run. This was a real-world test across all our installations to verify if we could pass on a patch and then deploy it as soon as we have confirmed that the patch works for all the versions that we have available on our Dropsolid Platform. For example, it verified if the patch tool is available on the server, it injected a text file that we then patched to make sure the flow of patching a Drupal installation would go smoothly, etc. Obviously we detected some hiccups as we were testing, but we were left with enough time to resolve all issues in advance.

Throughout the evening, we had plenty of engineers on stand-by, ready to jump in should something in the automated process go wrong. The entire rollout took us about 2 hours - from the release of the patch over verifying the patch on all the different Drupal releases to rolling it out on all sites and, finally, relax with a few beers. This doesn't mean we had it easy. We had to work a lot, but a lot of hours just to make sure we could handle this load in this amount of time. That is why we are continuously building on our Dropsolid Platform.

Those who joined our hangout could bear witness to exactly how comfortable and relaxed our engineers were feeling during the rollout.

You might ask, joined our hangout? What are we on about exactly? Well, since the Drupal community was in this together, I suggested on Twitter to all join in together and at least make it a fun time.

A few nice things that happened during this hangout:

  • Someone played live ukelele for us while we waited
  • Someone posted a fake patch and made everyone anxious, but at least it was a good test!
  • People were able to watch Dropsolid in total transparency how we coped with this patch and were also able to interact and talk to others in the hangout.

It made the whole evening a fun activity, as witnessed by Baddy Sonja.

Obviously this couldn’t have happened without the help of our great engineers at Dropsolid - and also because we invest a lot of our R&D time into the development of the Dropsolid Platform, so we can do the same exercise times 10 or times 100 without any extra human effort. Thanks to the Drupal security team for the good care and the warning ahead of time. It made a tremendous difference!

All our Dropsolid customers can rest assured that we have their backs, all the time!

If you are not a Dropsolid customer yet and you are interested to see how we can help you make your digital business easy, we’d be more than happy to talk. If you are running a Drupal site and need help with your updates or with your processes, we’d be glad to to help out and onboard you onto our Dropsolid Platform. You can keep your server contract while benefiting from our digital governance and expertise. Are you in charge of many many digital assets and feeling the pain? Maybe it’s time you can start doing the fun things again - just have a chat with us!

 

Get in touch

Categories: Drupal

Evolving Web: Structuring Content with Drupal 8

4 April 2018 - 7:11am
Structuring Your Drupal Website

Drupal has always been a strong content management platform. The number one reason we use Drupal is because it so easily adapts to our clients’ content models. It enables us to easily map and structure many different types of complex content.

Let’s look at how we go about structuring that content in Drupal, and how we use terminology to define, group and link different types of content.

Content Entities

In Drupal 8, every piece of content is an entity. To structure a site, you want to define different types of entities that will store different types of content.

Let’s take a publishing website as an example. We’re going to create entities for: books, authors, editions, interviews, reviews, book collections, book categories, and so on. You can start by drawing a map of all these nouns. I like mapping out content on a whiteboard because it’s easy to erase and change your mind and it’s bigger than a piece of paper.

Relationships

Once you’ve mapped all the different types of content that will exist on your site, identify the connections between them. Simply draw arrows arrows between the content types that are related to one another.

For example:

  • A book has an author (or multiple authors): draw an arrow from book to author

  • A book can have editions: draw an arrow from book to edition

  • A book can have reviews, interviews: connect these

  • A book collection has books: group books by collection

  • A book has categories: associate books with topics and categories

Entity Terminology: Bundles, Nodes, Taxonomy, Paragraphs, Blocks

Nodes, taxonomy terms, custom blocks, and paragraphs are all different types of entities. Each entity type has unique properties that make it better suited for different use cases and content types.

Here’s a breakdown of the most important Drupal terminology you need to know to structure your content:

  • Node: A page of content is a node, accessible via its own URL
  • Taxonomy terms: Used to categorize other content, taxonomy terms live in a hierarchy. They can be used to filter content and create unique landing pages.
  • Paragraphs: Content that lives within other content and doesn’t need a dedicated URL is a paragraph.
  • Custom Block: Any content that will be reused throughout the site becomes a custom block. You can also embed a block in a node.
  • Bundle: An entity sub-type is a bundle. Usually, bundles can have have unique fields and settings.
  • Field: A field is a component of the content, i.e. an ISBN, author’s name, or book title
Applying this Model to our Example Project

Here’s how we would decide which entity type to use for each content type:

  • Books and authors become nodes

  • Book categories become taxonomy terms

  • Interviews, reviews and editions could be paragraphs

  • Books and authors would be node bundles (aka content types)

  • A book category is a taxonomy bundle (aka vocabulary)

  • A book collection is a block bundle (block type)

  • Reviews and interviews are paragraph bundles (aka paragraph types)

  • A book collection that needs to be displayed on several pages becomes a block

Focusing on Each Entity to Create Fields

Once you’re looking at a book, you can start to think about what defines a book.

Ask yourself:

  • What information should it have?

  • Which information needs to be displayed?

  • How will we filter and order this content?

  • Will there be a single value for the field or multiple values?

List the various components of the content: title, author, ISBN, covers, genres, editions, reviews, interviews. Each of these will be a field.

Fields in Drupal can be single value (for example, each book has a single ISBN number) or multi-value (a book can have multiple reviews or authors). There are many other fields types that can store the content in a certain way that will affect how it can be displayed or used later (text, date, number, email, link, etc). A field that links one entity to another is a ‘reference’ field.

Information Architecture

So far we’ve talked about structuring your content using entities and bundles. But how do users actually access your content? When you’re building out your site map, you’ll probably picture top-level pages. These may link to dynamic lists of content, or they may have sub-pages that are added beneath them.

Linking to Content

In Drupal, we have three main ways to link to content: menus, views, and fields. In general, this is how we use them:

Menus are for static content: Menus are a static hierarchy of content. If you’re creating permanent content on the site that will be relevant for a long time, you’ll probably link to it through a menu.

Views are for dynamic content: Content that is ‘dynamic’ that will be added to frequently and is too abundant to add to a menu will probably be listed and linked to via views (the Drupal term for ‘list of content’).

Entity reference fields or link fields: You can also explicitly add a link from one content item to another using an entity reference field or a link field. For example, if you have a book and you want to have it link to three other hand-selected ‘related books’, you could create a ‘Content’ reference field for this.

You can go through your site map and figure out which pages are static (linked to by the menu) and dynamic content (linked via views). Landing pages tend to be connection pages. For example, a landing page might live in the menu, list a bunch of dynamic pages and also include explicit links to other pages via ‘calls to action’.  

Applying Menus and Views to Our Example

Using our example, you may have a static page for ‘About Us’, ‘Contact Information’, or ‘History of Publishing’. These would be created as pages and linked to via the menu.

You may also have a page that lists all the books and another that lists all the authors. Because your lists of books and authors are likely to change often, these lists should be created using views. When you add a new book or a new author, it automatically appears in the list.

Taxonomies make creating lists more interesting because we can create lists of content that are filtered by a particular taxonomy term. For example, if ‘prize winning’ is a book category, a taxonomy allows us to create a list of all the books that are ‘prize-winning’.

Finally, you might have a landing page for an upcoming book tour that includes details about the tour, a link to the book being promoted, and also links to other books by the author.

Conclusion

There are many more things to know to build a site with Drupal. But when you’re planning out your content, you simply need to be able to draw out the structure and communicate this with your team. Knowing the basic Drupal concepts will help you communicate clearly and think about the site’s architecture at a high level.

To read about a real-life project in which we built out book content in Drupal 8, read about our project for Princeton University Press.

+ more awesome articles by Evolving Web
Categories: Drupal

Flocon de toile | Freelance Drupal: Working with the Drupal Commerce 2 checkout flows

4 April 2018 - 5:00am

Drupal Commerce 2 allows to define out of the box multiple checkout flows, allowing to customize according to the order, the product purchased, the customer profile this buying process and modify it accordingly. This is an extremely interesting feature, in that it can simplify as much as necessary this famous checkout flows. Do you sell physical (and therefore with associated delivery) and digital (without delivery) products? In a few clicks you can have two separate checkout flows that will take into account these specificities.

Categories: Drupal

Lullabot: Continuous Integration in Drupal 8 with Travis CI

4 April 2018 - 3:07am

This article is the second in our series on Continuous Integration tools for Drupal 8, which started with CircleCI. This time, we explore Travis CI.

Travis CI is the most well known CI tool for open source projects. Its setup process is straightforward and it offers a lot of flexibility and resources to implement Continuous Integration for any kind of project. In this article we will implement the same set of jobs that we did with CircleCI and then compare both tools.

Resources

This article makes references to the following resources:

Browse the demo project to discover where the CI components are placed, then use the one-line installer to add these components automatically to your project.

The goal

We want to run the following jobs in a Drupal 8 project when someone creates a pull request:

To accomplish the above, we will use the following tools in Travis CI:

  • Drush, Drupal’s command line interface, to perform Drupal-related tasks like installing Drupal or updating the database.
  • Docker Compose, via docker4drupal, to build the environment where Behat tests run.
  • Robo, a PHP task runner, to define a set of tasks for each of the above jobs.

Here is a screenshot of the Travis CI dashboard with the above setup in place:

undefined

Now, let’s see how this has been set up. If you want to dive straight into the code, have a look at the demo Drupal 8 repository.

Setting up Travis CI

Travis CI requires the presence of a .travis.yml file at the root of the repository that dictates how it will build and test the project. I have used this installer that adds the following files:

Additionally, a few dependencies are added via Composer, which are required for the CI jobs.

After adding the above files to the repository, it’s time to give Travis CI access to it. Open https://travis-ci.org and authenticate there with your GitHub account. Next, add the repository at the Travis CI dashboard as shown below:

undefined

That’s it! After this, future changes to the repository should trigger builds at Travis CI. If you create a pull request, you will see a status message like the following one:

undefined Seeing the jobs at work

Here is an excerpt of the .travis.yml file. We are leveraging Travis’ build matrix for spinning up three jobs that run in parallel:

env: matrix: - JOB=job:check-coding-standards - JOB=job:run-unit-tests - JOB=job:run-behat-tests install: - composer --verbose install script: - vendor/bin/robo $JOB

The script section is called three times: one for each value assigned to the $JOB variable. It calls a different Robo task each time. We decided to write the implementation of each job as Robo tasks because:

  • It makes the .travis.yml file easier to read and maintain.
  • It makes the job implementations portable between CI tools.
  • It gives developers an opportunity to run the jobs locally.

If you are curious what a Robo task looks like, here is the implementation of the one that runs Behat tests:

/** * Command to run behat tests. * * @return \Robo\Result * The result of the collection of tasks. */ public function jobRunBehatTests() { $collection = $this->collectionBuilder(); $collection->addTaskList($this->downloadDatabase()); $collection->addTaskList($this->buildEnvironment()); $collection->addTask($this->waitForDrupal()); $collection->addTaskList($this->runUpdatePath()); $collection->addTaskList($this->runBehatTests()); return $collection->run(); } Building the environment with Docker Compose

The build environment task shown above, $this→buildEnvironment(), uses Docker Compose to build a Docker environment where the Drupal site will be configured, the database will be updated, and finally, Behat tests will run.

In contrast with CircleCI, where we define the mix of Docker images that the test environment will use to run the jobs, Travis CI offers two environments (Precise and Trusty) with common pre-installed services. Trusty has everything that we need for checking coding standards or running PHPUnit tests, but Behat tests require more setup which we find easier to manage via Docker Compose.

Here are the contents of the build environment task. For simplicity, we have removed a few unrelated lines:

/** * Builds the Docker environment. * * @return \Robo\Task\Base\Exec[] * An array of tasks. */ protected function buildEnvironment() { $force = true; $tasks = []; $tasks[] = $this->taskFilesystemStack() ->copy('.travis/docker-compose.yml', 'docker-compose.yml', $force); $tasks[] = $this->taskExec('docker-compose pull --parallel'); $tasks[] = $this->taskExec('docker-compose up -d'); return $tasks; }

The above task uses this docker-compose.yml file to build the environment.

Generating and visualizing coverage reports

Travis CI does not support storing artifacts like CircleCI does. Therefore, we need to use a third-party service to host them. Travis documentation suggests either uploading them to an Amazon S3 bucket or using Coveralls, a hosted analysis tool. We chose the latter because it posts a summary in each pull request with a link to the full coverage report.

Setting up Coveralls is straightforward. Start by opening https://coveralls.io and then, after authenticating with your GitHub account, use their browser to find and connect to a repository, like this:

undefined

Next, it is recommended to review the repository settings so we can customize the developer experience:

undefined

With that in place, new pull requests will show a status message with a one-line summary of the coverage report, plus a link to the full details:

undefined

Finally, when we click on Details, we see the following coverage report:

undefined A comparison to CircleCI

CircleCI can do all that Travis CI does with less setup. For example, coverage reports and Behat screenshots can be stored as job artifacts and visualized at the CircleCI dashboard. Additionally, CircleCI’s Command Line Interface gives a chance to developers to debug jobs locally.

Travis CI shines on flexibility: for example, only the Behat job uses Docker Compose to build the environment while the rest of the jobs use the Trusty image. Additionally, there is a huge amount of articles and documentation, which you will surely find helpful when tweaking the jobs to fit your team's needs.

If you liked Travis CI, check out this installer to get started quickly in your Drupal 8 project.

What next?

We aren’t sure about which tool to pick for our next article in this series on CI tools for Drupal 8. Do you have a preference? Do you have feedback on what you’ve found relevant about this article? Please let us know by posting a comment.

Acknowledgements
Categories: Drupal

Pages