Planet Drupal

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

Amazee Labs: Transparent Database Sanitization with GDPR-dump

7 August 2018 - 5:12am
Transparent Database Sanitization with GDPR-dump

With GDPR in full effect, sanitization of user data is a fairly hot topic. Here at Amazee we take our clients and our clients’ clients privacy seriously, so we have been investigating several possible approaches to anonymizing data.

In the Drupal world, and the PHP world more generally, there are several options available. Here, though, I’d like to discuss one we think is particularly cool.

Blaize Kaye Tue, 08/07/2018 - 14:12

At Amazee Labs’ Global Maintenance, we work with several different projects per day. We move data from our production to staging and dev servers, and from our servers to our local development environments. Especially on legacy systems, site-specific configuration details often exist only in the databases, and even if that weren’t the case, the issues we’re investigating routinely require that we dig into the database as it (more or less) is on the production servers. Anonymization is crucial for our day to day work.

So our considerations here are, how do we balance productivity while keeping things anonymous?

One way of achieving this is to make Anonymization transparent to the developer. Essentially, we want our developers to be able to pull down the live database as it exists at the moment that they pull it down, and have it be anonymized.

How can we achieve this?

Well, one way is to analyse the daily workflow to see if there are any points at which the data has to flow through before it reaches the developer?

It turns out that, if you’re working with mysql, this “final common path” that the data flows through is the mysqldump utility.

If you’re running backups, chances are you’re using mysqldump.

If you’re doing a drush sql-sync there’s a call to mysqldump right at the heart of that process.

Mysqldump is everywhere.

The question is, though, how do we anonymize data using myqldump?

The standard mysqldump binary doesn’t support anonymization of data, and short of writing some kind of plugin, this is a non-starter.

Fortunately for us, Axel Rutz came up with an elegant solution, namely, a drop in replacement for the mysqldump binary, which he called gdpr-dump. A few of us here at Amazee loved what he was doing, and started chipping in.

The central idea is to replace the standard mysqldump with gdpr-dump so that any time the former is called, the latter is called instead.

Once the mysqldump call has been hijacked, so to speak, the first order of business is to make sure that we are actually able to dump the database as expected.

This is where mysqldump-php comes in. It’s the library on which the entire gdpr-dump project is based. It provides a pure PHP implementation of mysqldump as a set of classes. On its own, it simply dumps the database, just as the native mysqldump cli tool does.

A great starting point, but it only gets us part of the way.

What we’ve added is the ability to describe which tables and columns in the database being dumped you would like to anonymize. If, for instance, you have a table describing user data with their names, email, telephone numbers, etc. You can describe the structure of this table to gdpr-dump and it will generate fake, but realistic looking, data using the Faker library.

This requires some upfront work, mapping the tables and columns, but once it is done you’re able to call mysqldump in virtually any context, and it will produce an anonymized version of your database.

There is still a lot of thinking and work to be done, but we think it’s worth investing time in this approach. The fact that it can be used transparently is its most compelling aspect - being able to simply swap out mysqldump with gdpr-dump and have the anonymization work without having to change any of the dependent processes.

If any of this piques your interest and you’re looking for more details about how you might be able to use gdpr-dump in your own workflow, feel free to check out the project (and submit PRs): https://github.com/machbarmacher/gdpr-dump.

Categories: Drupal

ADCI Solutions: Visual regression testing with BackstopJS

7 August 2018 - 3:26am

The larger a project, the more time you will spend on regression testing after each change. But there are a lot of tools which can help you to reduce efforts for this process. One of them is BackstopJS.

Get acquainted with BackstopJS

Categories: Drupal

OSTraining: The Ultimate Tutorial for Drupal's Paragraphs Module

6 August 2018 - 10:25am

Over the last few months we've worked with more and more Drupal 8 sites. Those projects all had one thing in common ... they used the Drupal Paragraphs module.

Paragraphs is a very popular module for handling content in Drupal 8.

Paragraphs works in a similar way to content fields, but also provides a wide range of options for the design, layout and grouping of your content. 

Categories: Drupal

Jacob Rockowitz: Caring about webform accessibility

6 August 2018 - 7:00am

It is easy to not care about accessibility, mainly because we generally don't see or understand how people with disabilities use our applications. Frankly, even usability testing can become an afterthought when it comes to building websites. There are lots of move parts to a website or an application, and it is hard to pause and ask can someone access this information using just their keyboard and/or a screen reader. The more accessible your website is, the more users you can reach and engage with your website's mission or purpose.

At Design4Drupal in Boston, caring about accessibility became the central theme for my presentation, titled ’Webform Accessibility'. After I gave my presentation, I created Issue #2979628: [meta] Improve Webform Accessibility and started fixing some obvious and not-so-obvious issues with the Webform module for Drupal 8. Andrew Macpherson, one of the Drupal Accessibility Topic maintainers, was kind enough to spend an entire train ride from NYC to Boston discussing (via Drupal Slack) form related accessibility issues and how to resolve them.

There are tools that can show you obvious problems

The most common form accessibility issue I see across the web is a failure to provide descriptive labels for form inputs. Labeling form inputs makes it possible for a screen reader to describe what input value is expected, as well as determine how it’s going to be used. For example, a screen reader needs to be able to identify a website's search box so that users can find content quickly. The solution is to provide a hidden label or title attribute to a site's search...Read More

Categories: Drupal

I Fix Drupal: Debugging "Relay log read failure" With MySQL Master-Slave Replication For Drupal

6 August 2018 - 2:28am
Our Drupal 7 installation has served us well using a single, optimised MySQL database server. However, a desire to deliver advanced reporting and dashboards driven by Power BI required us to implement a replicated slave so that Power BI could draw data from a datasource that would not impact the performance of the database serving the website. Mostly the configuration was straightforward: Replicate a MySQL 5.5 master into a single MySQL 5.7 slave Stitchdata tunnels into MySQL slave to access binary logs - Stitchdata requires at least MySQL 5.6, which explains the version difference you...
Categories: Drupal

Jason Pamental's RWT.io Blog: Drupal 8 Theming Quickstart

4 August 2018 - 7:46am
Drupal 8 Theming Quickstart jpamental Sat, 08/04/2018 - 10:46

This is a full-day workshop diving into the structure of a new them in Drupal 8. We’ll learn about the structure, how to create a theme, add/remove/replace CSSand JS libraries, include external resources like web fonts, and look learn the basics of Twig and the new templating system.

Download the workshop slides here.

 

Workshop Past Events Topics Drupal Planet Drupal
Categories: Drupal

Mediacurrent: The Marketer’s Guide to Drupal 8: Why Open Source is the Right Fit for your Organization

3 August 2018 - 12:26pm

We all have heard the debate about Open Source Software and Closed or Proprietary; but what is the real difference?

Simply: 

Open source software is available for the general public to use and modify from its original design free of charge. 

versus

Closed source where the source code is not shared with the public for anyone to look at or change. 

One of the main advantages of open source software is the cost; however, when applied to OSS, the term "free" has less to do with overall cost and more to do with freedom from restrictions. 

90% 
According to Forrester Research 90% the code in a typical application is Open Source.  

For a Closed Source CMS, depending on the choice of software, the cost can vary between a few thousand to a few hundred thousand dollars, which includes a base fee for software, integration and services, and annual licensing/support fees. 

In a 2017 report by Black Duck Software by Synopsys, nearly 60% of respondents said their organizations’ use of open source increased in the last year citing: 

  • cost savings, easy access, and no vendor lock-in (84%)
  • ability to customize code and fix defects directly (67%)
  • better features and technical capabilities (55%)
  • the rate of open source evolution and innovation (55%).

 

1M+ 

Websites across every industry vertical —from Georgia.gov to Harvard— trust Drupal as a secure open source CMS platform. 

Open Source Software has a long-term viability and is always on the cutting edge of technology.  Selecting technologies means committing to solutions that will support an active, growing business over the long term, so it requires careful consideration and foresight.  Here are some of the benefits of open-source to consider:

1. Value for cost 
       Worried about your marketing budget when looking at changing your CMS? Open source software has no licensing fees! It’s free, which means room to spend your $ on other initiatives.
2. Added Security
       Open source - means community. The more people (developers) looking at the source code, the more fixes and regular updates will be available. What can sometimes takes weeks or months to resolve with proprietary software takes just hours or days with open source. This will help give your marketing team a piece of mind knowing that if you don’t have time to look at the code of your site - or you don’t know how - then there are developers all over the world continuously checking for bugs & fixes.
3. Customizability
       Have a really customized idea for your site that you’ve never seen elsewhere? Open Source can help. By customizing the code to fit your needs, it provides a competitive advantage for your business.
4. Flexibility
       Open-source technology naturally provides flexibility to solve business problems. Your team and organization can be more innovative, and it gives you the ability to stay on the cutting edge of latest trends & designs.
5. Integrations
       With open source, especially Drupal, you can Integrate the best-of-breed marketing technology. It is architected for easy integration with your tools - Marketing automation, email service providers, CRM, etc… Drupal 8 gives you the foundation for your digital experience ecosystem.
6. Speed
       This isn’t just about site speed, but the ability to get your site up and running - with full marketing capabilities - on time & within budget. Open source allows you to deliver value right away.
7. Scalability 
       Drupal and other open source platforms give you the advantage of being able to scale your digital presence for the future. You're not confined to stick with what you already have. You can continue to evolve and build long-term with open source.

The Benefits of Open Source can go on for pages but it’s important when evaluating your options to think about your business and its goals. Once consistent need we see is having access to a CMS that is easy for you and your team to manage on a day-to-day basis.

In the next blog of the series - we’ll hear from the Associate Director of Digital Marketing at Shirley Ryan Abilitylab, about how he is leveraging open source - particularly Drupal - to achieve his business goals. 

Categories: Drupal

Mediacurrent: The Marketer’s Guide to Drupal 8: Why Open Source is the Right Fit for your Organization

3 August 2018 - 12:26pm

We all have heard the debate about Open Source Software and Closed or Proprietary; but what is the real difference?

Simply: 

Open source software is available for the general public to use and modify from its original design free of charge. 

versus

Closed source where the source code is not shared with the public for anyone to look at or change. 

One of the main advantages of open source software is the cost; however, when applied to OSS, the term "free" has less to do with overall cost and more to do with freedom from restrictions. 

90% 
According to Forrester Research 90% the code in a typical application is Open Source.  

For a Closed Source CMS, depending on the choice of software, the cost can vary between a few thousand to a few hundred thousand dollars, which includes a base fee for software, integration and services, and annual licensing/support fees. 

In a 2017 report by Black Duck Software by Synopsys, nearly 60% of respondents said their organizations’ use of open source increased in the last year citing: 

  • cost savings, easy access, and no vendor lock-in (84%)
  • ability to customize code and fix defects directly (67%)
  • better features and technical capabilities (55%)
  • the rate of open source evolution and innovation (55%).

 

1M+ 

Websites across every industry vertical —from the White House to Harvard— trust Drupal as a secure open source CMS platform. 

Open Source Software has a long-term viability and is always on the cutting edge of technology.  Selecting technologies means committing to solutions that will support an active, growing business over the long term, so it requires careful consideration and foresight.  Here are some of the benefits of open-source to consider:

1. Value for cost 
       Worried about your marketing budget when looking at changing your CMS? Open source software has no licensing fees! It’s free, which means room to spend your $ on other initiatives.
2. Added Security
       Open source - means community. The more people (developers) looking at the source code, the more fixes and regular updates will be available. What can sometimes takes weeks or months to resolve with proprietary software takes just hours or days with open source. This will help give your marketing team a piece of mind knowing that if you don’t have time to look at the code of your site - or you don’t know how - then there are developers all over the world continuously checking for bugs & fixes.
3. Customizability
       Have a really customized idea for your site that you’ve never seen elsewhere? Open Source can help. By customizing the code to fit your needs, it provides a competitive advantage for your business.
4. Flexibility
       Open-source technology naturally provides flexibility to solve business problems. Your team and organization can be more innovative, and it gives you the ability to stay on the cutting edge of latest trends & designs.
5. Integrations
       With open source, especially Drupal, you can Integrate the best-of-breed marketing technology. It is architected for easy integration with your tools - Marketing automation, email service providers, CRM, etc… Drupal 8 gives you the foundation for your digital experience ecosystem.
6. Speed
       This isn’t just about site speed, but the ability to get your site up and running - with full marketing capabilities - on time & within budget. Open source allows you to deliver value right away.
7. Scalability 
       Drupal and other open source platforms give you the advantage of being able to scale your digital presence for the future. You're not confined to stick with what you already have. You can continue to evolve and build long-term with open source.

The Benefits of Open Source can go on for pages but it’s important when evaluating your options to think about your business and its goals. Once consistent need we see is having access to a CMS that is easy for you and your team to manage on a day-to-day basis.

In the next blog of the series - we’ll hear from the Associate Director of Digital Marketing at Shirley Ryan Abilitylab, about how he is leveraging open source - particularly Drupal - to achieve his business goals. 

Categories: Drupal

Ashday's Digital Ecosystem and Development Tips: Using the Google Natural Language API with Drupal

3 August 2018 - 12:00pm

If you haven’t heard of the phrase “Natural Language Processing” by now, you soon will. Natural Language processing is an expanding and innovative use of technology to analyze large amounts of data or content and derive meaning from it, short-cutting a tremendous amount of manual effort needed to do that ourselves. It’s been around in some form for quite a while, but it was often relegated to complex enterprise systems or large corporations with a vested interest in automating the data mining of huge amounts of data to figure out what the patterns were, for example, in consumer purchasing trends or social media behavior. It’s a cool idea (it’s a form of artificial intelligence after all) and fuels a lot of our online experience now whether it’s product recommendations, content recommendations, targeted ads, or interactive listening services like Siri or Alexa. What’s even better is that this sort of thing is becoming more and more accessible to use in our own software solutions as many of these now provide services with APIs. This allows us to provide a more personalized or meaningful experience for site visitors on web projects that likely don’t have the budget or requirements to justify attacking natural language processing itself and can instead find accessible ways to benefit from the technology.

Categories: Drupal

OpenSense Labs: Top 2018 Drupal Modules using Artificial Intelligence

3 August 2018 - 1:20am
Top 2018 Drupal Modules using Artificial Intelligence Akshita Fri, 08/03/2018 - 13:50

Considering the spectacular potential AI has, no wonder it one of the most-sought-after trends in the businesses today. You might be employing it in your online business already in the form of chatbots offering smarter features to the users. 


Want to employ artificial intelligence on your Drupal website but don't know where to start from? In this blog, we will share some cool Drupal modules for you to innovate and be part of the current trends.

Top Drupal Modules Using Artificial Intelligence
  1. Intelligent Content Tools

    The Intelligent content tools module is developed by OpenSense Labs with the popular scope to merge Natural Learning Processing with Drupal 8 to help with:
     
    • Auto-tagging: The Auto-Tag Module assists with tags. It analyzes the content on the website with the field specified and then it tags the content by extracting text from that field. The module will automatically tag the articles with tags generated from the content and so it’ll be a lot easier for the users to look for contents with the same tags. 
       
    • Text Summarization: It summarizes the text in the field. For a media website, it is important that the teaser shows just the right information. The text summarizer helps in writing the summary doesn't matter how big the number is.
    • Duplicacy in content: And while the number of plagiarism checkers available in the market is high, Duplicity Rate Module tells you if there is any duplicate content available on the website. It is an intelligent agent module based on Natural Language Processing. It’s a helpful tool for a website designer and content editor. 

      Available for - Drupal 8 | Not covered by Security Advisory

      Read more about How NLP & Drupal Can Provide The Best User Experience
       
  2. Cloudwords for Multilingual Drupal

    No matter how popular your enterprise is, nothing can beat the essence of familiarity that native tongue/language brings. Built for marketers, by marketers, Cloudwords for Multilingual Drupal gives you the power to deliver global campaigns and localized assets with speed and scale. This is the marketing opportunity that no e-commerce business should miss out on.

    Cloudwords can onboard any language provider in a manner of minutes and help you deliver globally consistent, high quality and timely content to multiple countries in many languages. Its smart AI allows the workflow automation and powerful project management capabilities to select the content you want to localize and Cloudwords does the rest. 

    Its CAT tool has a smart internal translator which leverages artificial intelligence and machine learning to significantly increase the productivity.

    It can automatically extract all the content and create project request in Cloudwords. All content is automatically represented in the translation industry’s XLIFF format making it simple to process and interoperable with a wide variety of tools.

    Available for - Drupal 8 | Stable Release

  3. Azure Cognitive Services API

    Azure Cognitive Services API module can seamlessly integrate with intelligent features and with the use of Machine Learning, Artificial Learning, and Natural Learning Process can detect speech, facial and vision recognition other than identifying the sentiments. 

    It offers four different modules for each feature:

    • Face API Module: It integrates with Microsoft Face API, a cloud-based service that and helps identify face detection with attributes and face recognition. It can: 

      1. Detect human faces and compare similar ones
      2. Organize images into groups based on similarity
      3. Identify previously tagged people in images
    • Emotion Recognition API Module: Although in beta, it takes an image as an input, and returns the confidence across a set of emotions for each face in the image, as well as bounding box for the face, from the Face API. 
       
    • Computer Vision API Module: It extracts information from images to categorize and process visual data – and machine-assisted moderation of images to help curate your services.
       
    • Azure Text Analytics API Module: Text Analytics API is a cloud-based service that provides advanced natural language processing over raw text, and includes three main functions: sentiment analysis, key phrase extraction, and language detection.

      Available for - Drupal 8 | Stable Release
  4. Acquia Lift Connector

    Looking for a module that can help you merge content and customer data into one tool? Acquia Lift helps you deliver the most cohesive and personalized experiences across multiple channels and devices.

    With the ability to target audiences in real-time, marketers are able to scale their web personalization efforts in order to drive conversions and bottom-line results. This module provides integration with the Acquia Lift Service and an enhanced User Experience for Personalization, Testing and Targeting directly on the front-end of your website.

    Features

    • Drag-and-drop UI for content targeting

    • Unified customer profile

    • Merging anonymous and known visitor profile

    • Content distribution

    • Real-time, adaptive segmentation

    • Behavioral targeting and A/B testing

      Available for - Drupal 8 | Stable Release

  5. Quora - Related Questions / Posts

    One of the old school marketing techniques involves promoting content through various open/public channels. The Quora Module helps provides related questions/posts from Quora in your Drupal website in a Block.

    The smart intelligence uses tags (provided by the fields of one of the content type) to fetch the relevant Quora questions. The field acting as the interconnection between your Drupal website and Quora is easily configurable.

    This module uses:

    • Google's Custom Search Engine (CSE) API - to fetch Quora questions/posts 

      Available for - Drupal 8 | Version not stable 
      Drupal 7 | Stable Release

  6. Automatic Alternative Text

    The basic principle at work here is the idea of easy perceivability. Any and every information should be, thus, presented in such a way that is easily perceivable to the user. It is required for any non-text information like images and video to describe the content in the form of text for the screen readers to read it. 

    The Automatic Alt text module automatically generates an alternative text for images when no alt text has been provided by the user. This module works great for the websites and portals with user-generated content where the users may even not be aware of the purpose and importance of the Alternative text. 

    It describes the content of the image in one sentence but it doesn’t provide face recognition. 

    Available for - Drupal 8 | Stable Release

    Read how Drupal is Ensuring the Web Accessibility Standards

  7. Chatbot API

    In the era of Personal Assistants like Alexa, Google Home, Chatbots are the cool fad for your website. The Chatbot API module creates a common layer serving Drupal content to any of the Personal Assistants services in the market.

    However, the module has the dependency on other modules like Drupal Alexa. Chatbot API by itself doesn't do anything. You should install it only if another module asks for it or you want to build your own integration driver.

    Available for - Drupal 8 | Not covered by Security Advisory 

  8. OpenCalais

    An integration with Thomson Reuters' Calais web service with Drupal, OpenCalais creates rich semantic metadata for the content you submit – in well under a second. Using NLP, Calais analyzes the document and finds the entities within it. The metadata returned can be automatically assigned to vocabularies, or it can only suggest terms allowing full user control of the tagging.

    Goind beyong the classic entity identification, Calais returns the facts and events hidden within your text as well. 

    Available for - Drupal 7 | Stable Release

  9. SendPulse

    The SendPulse module provides integration with SendPulse, which is an Integrated Platform for Web and Push Notifications. It assists greatly when revamping your marketing and focussing on the mails and SMS. It claims to assist in providing 60% open rates with the use of its Artificial intelligence. 

    It also heavily relies on personalization in order to achieve the numbers. The AI monitor’s the user behavior such as email opening hours, user communication preference, time zone, content among others. Once the information has been collected it’s AI predicts the medium and hour for the best results. 

    Features:

    • SendPulse Mailing Lists

    • Pulling and updating mailing lists from SendPulse using cron

    • Mass export users from Drupal to SendPulse

    • Map Drupal user fields with SendPulse mailing lists variables

    • Creating new SendPulse Mailing Lists from Drupal admin interface

      Push Notifications

    • Auto-creating new Push Notification and sending to subscribers after creating a new node

    • You can control for which node types after creating new node should create push notifications

    • Form for sending a single Push notification.

      Available for - Version 7 | Stable Release

Artificial Intelligence, Machine Learning have a lot to offer and have the potential to improve user interactiveness in your website. The use cases of AI and ML can range from personalization to innovation to communication.

Looking for a smart solution for your business? Contact us at hello@opensenselabs.com

blog banner blog image Drupal module Artificial Intelligence Machine Learning Chatbot Personalization Drupal 8 Drupal Personalization Smart Content Blog Type Tech Is it a good read ? On
Categories: Drupal

OSTraining: The Animation Module in Drupal 8

2 August 2018 - 9:16pm

There are multiple JavaScript and CSS libraries on the internet. They allow you to animate certain parts of your site and make them look more attractive.

The Animations module in Drupal makes use of the three useful libraries:

  • animate.css
  • typed.js
  • WOW.js

They give the elements inside your site some extra cool features and make it more appealing.

In this tutorial, you will learn how to install the required libraries and the module and take a look at its basic usage.

Let’s start!

Categories: Drupal

Jeff Geerling's Blog: NEDCamp 2018 - Keynote on DevOps

2 August 2018 - 3:34pm

Over the past decade, I've enjoyed presenting sessions at many DrupalCamps, DrupalCon, and other tech conferences. The conferences are some of the highlights of my year (at least discounting all the family things I do!), and lately I've been appreciative of the local communities I meet and get to be a part of (even if for a very short time) at Drupal Camps.

The St. Louis Drupal Users Group has chosen to put off it's annual Camp to 2019, so we're guiding people to DrupalCorn Camp, which is only a little bit north of us, in Iowa.

Categories: Drupal

Purdy Good Blog: DrupalCon changes = less value

2 August 2018 - 10:39am
Categories: Drupal

Tandem's Drupal Blog: Lando + Envoy

2 August 2018 - 9:34am
August 03, 2018 Learn to automate deploy steps with envoy on affordable hosting. Why Envoy Envoy is a task runner put together by the Laravel team. When I can I like to use hosts like Pantheon and Platform.sh that give me a wealth of tools, containers in production, and a lot less DevOps headaches when something like Heartbleed happens 😱...
Categories: Drupal

Mediacurrent: How to Build a Card Component

2 August 2018 - 8:13am

One of the most popular components on any website I've worked on is the card component.  Depending on the website, the card component is used to group various pieces of content into a container which can be used throughout your website.  Here’s an example of a card component in one of our projects.

In some instances, a card can be a user profile, content teaser/excerpt, latest news or events.  Today we will build a card component which will contain the information for the latest events.  This card can be used in the /events page to list all the latest events taking place.  The card can also be used in other pages and it may need to be displayed slightly different than the original card, this transformation is called "variations" and is usually achieved by passing a modifier CSS class to the original component which we can use to write different styles for the card.  More on this later.

Let's get started

First, let's take a look at what we are building so we have a visual of the code we will be writing.

As you can see from the images above, our card takes different shapes but the information in it remains the same or similar.  This is a common practice to modify components based on where and how they are being displayed.

Let's build the cardIdentify component's fields

Before starting to write any code, let's take a close look at the card images to identify the fields or data elements the card needs.  From the images above we can see the following fields will be needed:

  • Image
  • Title
  • Subtitle
  • Excerpt
  • Label or category
  • Label for comments
  • Label for time posted

Typically, components are built following the Atomic Design approach which basically means breaking things down into small pieces (atoms) and then combining those pieces to build more elaborate components.

In the interest of time, we are going to skip building each piece as its separate component and instead we will build the card as a whole.  I recently wrote a blog post on building flexible headings which demonstrate the approach I usually take when building components.

Architecting the component fields

We know the fields we need but it is helpful to determine what type of fields they are and what they will be called.  The table below gives us a good visual of our fields architecture.

Writing the code

1. In your components or patterns directory in your project, create a new folder called `card`

2. Inside the Card folder create two new files
          -  card.html
          -  card.css (we're using CSS to keep things simple.  Feel free to use Sass if you'd like).

3. In your card.html we'll start with the basic structure of the card

<article class="card">...</article>

So we've created an article tag as the card's container.  Why <article>  and not <div>?  Well, since the card is intended to contain an event's info, if we place a bunch of cards together it makes sense that each card is an individual event article.

4. Next we are going to create wrappers for the two types of data the card will hold.  The two types of data as we have seen from the table above are: Image/media and text or content.  Let's modify our code so it looks like this:

<article class="card">
 <div class="card__media">...</div>
 <div class="card__content">...</div>
</article>

The reason for splitting the image and the rest of the content is that this allows us to move things around independently of each other to create different variations of the card.  More on this later.

Let's pause to review how content will be laid out

If we look at the card images above, we see that some of the fields are either on the image side and others are grouped together separate from the image.  Although we could potentially place fields in the image or content wrappers, it makes sense to place them in the wrapper where they visually appear.

For example, the date and label fields (Photos), look like they belong in the same group as the image.  The rest of the fields will go in the Content wrapper.

5. Let's start with the image wrapper:

<article class="card">
 <div class="card__media">
   <img src="http://placehold.it/300x300" alt="Card image" />
   <div class="card__date">
     <span class="date--day">27</span>
     <span class="date--month">Mar</span>
   </div>
   <span class="card__category">Photos</span>
 </div>

 <div class="card__content">...</div>
</article>

So let's focus in the fields inside card__media. We see we have our image, which in this case is rendering a placeholder image.  Then we have a wrapper to hold the date fields (day and month).  Again, wrapping these two together makes it easy to manipulate them as a single item rather than two separate fields.  Lastly, we have the category for this content (Photos).  Since all these fields seem to belong together, it makes sense to place them the way we have.  Later on, we will use CSS to place each of the fields in their right position.

6. Now let's place the remaining fields inside the .card__content wrapper.  We will temporarily hide the fields in the .card__media wrapper to focus on the other fields.  Modify your markup to look like this:

<article class="card">
 <div class="card__media">...</div>

 <div class="card__content">
   <header class="card__header">
     <h2 class="card__title">City Lights in New York</h2>
     <div class="card__subtitle">The city that never sleeps</div>
   </header>
   <p class="card__excerpt">New York, the largest city in the U.S., is an architectural marvel with plenty of historic monuments, magnificent buildings and countless dazzling skyscrapers.</p>

   <footer class="card__meta" role="contentinfo">
     <span class="card__post-date">6 min ago</span>
     <span class="card__comments">39 comments</span>
   </footer>
 </div>
</article>

So the first thing we did was add a `<header>` tag to wrap the title and subtitle fields.  The header tag is a great way to indicate the role content plays in our component.  In addition, using semantically correct markup makes this component SEO friendly as well as accessible.  Next we have the teaser content wrapped in a <p> tag and finally, we add another semantic tag which is `footer` to wrap the publish date and comments fields.

Why this markup?

I'd like to bring up a couple of things to your attention regarding how I arrived at the markup above.  First, we are using BEM for naming CSS classes (card__title, card__comments, etc.).  BEM is great for creating associations on your component fields.  By looking at the markup you know where each field belongs.  This makes it easier to identify where you would find the styles or other assets for the component within your project when you have tons and tons of components.  The class card and all the other field classes are unique not only to this component but in the entire project.  This gives us the peace of mind that our styles will not inadvertently affect other areas of the website.

Notice I created two containers within the card (`card__media` and `card__content`). This allows me to split the card content into groups I can manipulate individually and independently of each other.  This will come in handy when we need to create a long or wide card.  In addition, by grouping multiple fields into a single container it is easier to manipulate the fields with CSS as a group rather than individually.

Atomic Design

If you are familiar with Atomic Design, you know the recommended way for building components is to break things down into the smallest pieces possible.  For example, in the card structure above, each of the fields that make up the card can actually be its own individual component.  Then we would combine them all into a whole new component (card).  In the interest of time/work, I am not breaking the card component into atoms. However, if I were building the card for a project I would definitely do that as this allows for components to be reused and save time/work in the long road.

Putting the entire card together

Now that we have built each piece of the card, your **card.thml** file should look like this:

<article class="card">
 <div class="card__media">
   <img src="http://placehold.it/300x300" alt="Card image" />
   <div class="card__date">
     <span class="date--day">27</span>
     <span class="date--month">Mar</span>
   </div>
   <span class="card__category">Photos</span>
 </div>

 <div class="card__content">
   <header class="card__header">
     <h2 class="card__title">City Lights in New York</h2>
     <div class="card__subtitle">The city that never sleeps</div>
   </header>
   <p class="card__excerpt">New York, the largest city in the U.S., is an architectural marvel with plenty of historic monuments, magnificent buildings and countless dazzling skyscrapers.</p>

   <footer class="card__meta" role="contentinfo">
     <span class="card__post-date">6 min ago</span>
     <span class="card__comments">39 comments</span>
   </footer>
 </div>
</article>

Card Styles

Now that we have the markup ready for the card component, we can begin writing our Sass/CSS to style it.  I am not going to go into detail about the styles as I have commented the parts that may need some explanation and should be easy to understand.  The main take away from writing styles for components with unique names is that there is little to no CSS nesting.  This makes overriding styles an easy task if there is ever a need to do so.  In addition, styles written for a component like this, don't run into the risk of leaking into other areas of the website.

That's a lot of CSS but it's all necessary to achieve the look and feel of the card.  It is important to know that your markup file (card.html), needs to reference your styles file (card.css) for things to work.  This may be obvious but if you are following along that's an extra step that needs to be done.
Creating a card variation

If  you would like to see the card displayed wide or horizontally, modify your card wrapper to look like this:

<article class="card card--wide">...</article>
 

Notice that by passing the CSS class of `card--wide` to the original card component we are able to change the orientation of the card from long to wide giving us an alternative variation to use without having to rebuild the card from scratch.  These variations are pretty powerful and present many advantages.

If you look at the styles, you will notice there is a block of CSS in which the card--wide is changed to move the card's content to the right of the image.  This is a great way to provide alternative views of a component without having to recreate the markup or styles for a component.

In closing

Building components is one of my favorite things to do as a developer and there are many advantages to this style of theming.  It's important to think through how components will be used so you can plan ahead how to best build a component that can be reused.  Rushing through building components without having a full understanding of where and how a component may be used can lead to duplicating code or redoing your work to accommodate new project requirements.

Categories: Drupal

Agiledrop.com Blog: AGILEDROP: How to Embed Videos in Drupal 8

1 August 2018 - 6:19pm
Videos have become a major part of the internet alongside images and of course text. They not only increase the engagement of your website but also making it more engaging. Historically, Drupal hasn’t been too media friendly and has been criticized for that compared to other CMS. But with Drupal 8 as well as its media initiative, those days are behind us. In this post, let’s take a look at how easy it is to embed a video on your Drupal 8 site. Start off by downloading the Video Embed Field module. Install the module and enable it (It requires the Drupal Media module to be enabled). Before we… READ MORE
Categories: Drupal

Debug Academy: How to quickly patch your Drupal site for today's Moderately Critical security release ( SA-CORE-2018-005 )

1 August 2018 - 5:04pm
Author: Ashraf Abed

Do you manage a Drupal site? You are likely to have heard about today's moderately critical security update: https://www.drupal.org/SA-CORE-2018-005

There's no time to spare - what now?

This update is has one key difference from the other recent security updates. Those security issues resided within Drupal core's code, whereas this update is in an external vendor package which Drupal core relies on. I'll spare you some of the details - the tl;dr is that makes it harder for us to provide a single patch you can reliably apply. Knowing the version of Drupal core you're running does not necessarily give us enough information to generate a patch.

Here is how to apply the security updates to your website if you are already on Drupal 8.5:

  • SSH into your website
    • Git add and commit all files
    • Create a database backup with drush:
      • drush sql-dump > ../../2018-08-01-pre-sa-core-2018-005.sql
  • Using Composer, and on Drupal 8.5.x?
    • composer update drupal/core --with-dependencies
    • Unsuccessful? Try: composer update drupal/core --with-all-dependencies
    • Still no luck? OK - this should work:
      • composer require symfony/http-foundation:~3.4.14
      • composer require symfony/http-kernel:~3.4.14
  • Not using composer, but are on Drupal 8.5.x?
    • I strongly recommend using composer in the near future. Until then, manually update the two packages:
    • ​Now that we have the new versions of the two packages, we need to replace the unsecure versions of those packages in our project:
      • Open your project
      • Within your project, find for these folders:
        • http-foundation
          • This can usually be found in: YOUR-PROJECT/vendor/symphony/http-foundation
        • http-kernel
          • This can usually be found in: YOUR-PROJECT/vendor/symphony/http-kernel
      • Those are the two unsecure folders. Note their location, and delete those folders
        • ​This step will break your website until the remaining steps are completed. Because of which, you should always perform development work on a dev environment, not on the live website.
    • Remember the zip files we downloaded earlier? Find those on your machine now.
    • Unzip the two zip files. You should now have these two folders on your computer:
      • http-foundation-3.4.14/
        • Rename this folder to http-foundation
        • Then move the renamed into your project, replacing the old http-foundation folder
          • This is normally YOUR-PROJECT/vendor/symphony/http-foundation
      • http-kernel-3.4.14/
        • Rename this folder to http-kernel
        • Then move the renamed folder into your project, replacing the old http-kernel folder
          • This is normally YOUR-PROJECT/vendor/symphony/http-kernel
    • Save (git add and commit) the updated folders on your website
    • Clear your websites cache
    • Test your website thoroughly
    • If everything looks good, you should be able to deploy these changes to the live website before clearing its cache

These steps come with no warranty, implied or otherwise.

Those steps will allow you to patch your site, not fully update it. Once the patches are in, you can rest assured that your site should now be secure. Take 24 hours off, then schedule fully updating your website to the latest version very soon. Future patches are not guaranteed to be applicable to earlier versions.

Categories: Drupal

Drupal Association blog: Changes Coming for DrupalCon Seattle 2019

1 August 2018 - 3:58pm

DrupalCon is evolving and improving to better meet your needs and those of the Drupal market. The goal of the project and the Drupal Association is to grow Drupal adoption and its impact in the world, and based on your feedback, we’re segmenting DrupalCon’s offerings -- which we affectionately call “tracks” -- to achieve this. This also comes with a different price point.

While the programming, speakers, sessions and more still make up the core of DrupalCon, for the first time, we’re retooling and creating more value to serve everyone in the Drupal lifecycle; builder/developers, agency owners, sales teams, content editors, marketers, end-user decision-makers….

The Backstory and Evolution

Growing adoption means inspiring and educating all decision-maker personas, so we’re creating programming and experiences uniquely tailored to each personas needs so that they can all find ways to participate in the continued evolution of the project.

Over the past few years, through surveys, evaluation forms, in-person comments, attendance data and meetings, the community provided valuable feedback and ideas about how DrupalCon North America could best target each of the differing attendees.

While making changes, we also want to make the experience for our alumni attendees even better. We pinpointed common themes and requests; namely more in-depth content, learning opportunities, and concentrated time for networking.

Serving Drupal's Personas

DrupalCon’s overall programming is now a siphoning of who you are and how your role uses Drupal. We’ll carve the Seattle conference center into 4 distinct areas; one for each persona track:

  • Builder Track
  • Agency Leadership Track
  • Content and Digital Marketing Track
  • Executive Summit

These tracks can better inform each group, allowing attendees’ time to be targeted and well-spent at DrupalCon as a whole. Each of these tracks will have their own space, their own journey and their own content -- with opportunities to come together in keynotes, social events, and the hallway track for the cross-pollination, community building, and DrupalCon’s culture of collaboration, which remain core benefits of attending the conference.

More About the Builder Track

As mentioned, in addition to expanding who DrupalCon serves, we also want to create a more valuable experience for returning attendees. The Builder Track will be for people who make the software and create the experience, with job roles including but not limited to: back end and front end developers, themers, QA specialists, technical leads and architects, site builders and other technical personas.

Here’s what’s new and different for this track, so that it better serves you:

  • Sessions will include multiple topic tags; content will be more accessible to attendees instead of in strict silos; no missing out!
  • Due to feedback, we have expanded our one-day programs to run on Monday and Tuesday, and our session, BoF and keynote content to full days on Wednesday and Thursday.
  • Adding new summits to provide expanded vertical networking opportunities in strong and emerging industries.
  • Increasing our offering of hands-on trainings and labs throughout the week to up-level knowledge.
  • We will work to provide more meaningful interactions at Drupal Association hosted social events.
  • More featured speakers -- offering new and relevant information from both inside and outside of Drupal.
  • Additional grants and scholarships so that a cross-section of contributors can attend.
  • An increase in the Speaker Inclusion Fund to ensure diverse voices and perspectives on our stages.
  • All-day free coffee (you read that right!)
In Dollar Terms

With all of this value comes another change that we haven’t made in three years, even as our costs to hold and host the event have escalated year over year: ticket prices. After careful consideration and analysis, the prices for 2019 have increased. Prices now align with industry standards in the North American market, yet remain the most affordable across the board. For context, Linux Open Source Summit starts at $950 and O’Reilly’s conferences start at $1,795. DrupalCon remains at or lower than similar events.

New Ticket Pricing:

Supporter Price

Conference Price

Early-Bird $595 $795 Regular $695 $894 Last Chance $795 $995 On-Site $1,095 $1,095

Supporting Partners’ organizations do a lot financially for Drupal, Drupal Association and DrupalCon. We recognize that many are also sponsors of DrupalCon and send numerous employees to attend every year. As a thanks for funding Drupal.org and the Engineering Team, we’re providing Supporting Partner organizations with a lower pricing tier on DrupalCon tickets moving forward.

To learn more about becoming a Supporting Partner, how fees fund Drupal.org, and how to get the supporter rate, click here.

Easing the Transition

While we are creating more value for DrupalCon attendees, we know it can be a challenge when pricing increases, so for 2019, we have an Individual Alumni Rate. If you have attended DrupalCon twice or more in recent years -- self-funded -- you have the opportunity to register with a different pricing structure. Those who attended both Nashville and Baltimore (or Nashville and Vienna) -- and who have provided us with their email contact information and opted in to our communications -- will be emailed this offer. If you are not opted in to DrupalCon communication but believe you qualify, you can go directly to https://seattle2019.drupal.org/registration. If you are logged in and you qualify, your Drupal.org username will allow you to access the registration button.

Supporting Partner organization employees who are sponsored by their employer to attend are not included in this rate; their early-bird rate is on par with the alumni rate.

Alumni registration opens Wednesday, August 1; General Registration opens Saturday, September 1 -- as does the Call for Papers.

Mark Your Calendars

We are committed to DrupalCon as the go-to event that accelerates the creation of Drupal digital experiences, and the place to collaborate with the largest open source community. The Drupal Association invites you to share what changes about the Con you're most excited about. Watch for our news outlining new programming, and we plan to see you face-to-face in Seattle, April 8-12, 2019!

Categories: Drupal

Commerce Guys: Drupal Commerce 2.8 & Cart Flyout Module Updates

1 August 2018 - 2:25pm

We recently released Drupal Commerce 2.8 and are excited to highlight some of the new features. We also published new releases of two key contributed modules that make lightning-fast, client-side Add to Cart forms possible, representing a significant improvement to the customer experience.

Drupal Commerce 2.8 adds BOGO support

The most significant new feature in the 2.8 release is the “Buy X, Get Y” offer type funded by Norwegian Drupal agency Ny Media. You can now configure promotions with just core functionality that grant free or reduced price products after a set number of other products have been added to the cart. This work required a re-architecture of parts of the promotions data model and a redesign of the user interface to make it easier for merchants to create promotions in general.

Other key updates and improvements in this release include:

Read the release notes to get the full scope of additional updates and also to learn about some backward compatibility breaks that affect custom promotions, custom tax types, and order processors. We'll keep chipping away at the core roadmap and plan to add query-level entity access to the API for the next release.

Commerce Cart Flyout “Add to Cart” Update

The newest release of the Cart Flyout module includes notable updates to its JavaScript based “Add to Cart” feature. In addition to powering an editable shopping cart in a “flyout” sidebar, it now improves the Add to Cart experience with a very fast client-side solution using resources defined by the Commerce Cart API.

The standard Add to Cart form uses Drupal’s Forms API to update form elements based on attribute selection. It can submit three to four Ajax requests on average while customers select a product variation, but the new module can build, update, and submit the form purely in the client via JavaScript. Because the server sends the browser all the data it needs to build the interactive form in the initial request, we're able to avoid any additional requests to the server until the customer is actually ready to initiate the Add to Cart. Check it out:

Following up on our Commerce 2.8 release, we've released updates to our Cart Flyout and Cart API modules to build, update, and submit dynamic Add to Cart forms purely in the browser via JavaScript. More on this decoupling effort in the latest blog: https://t.co/yXcZOv1RQy pic.twitter.com/bIikuiERaq

— Drupal Commerce (@drupalcommerce) August 1, 2018

Even under high visitor load, users will have a faster experience overall. Server resources are only devoted to users who decide to convert. Casual visitors can browse and modify product variations as much as they like and not affect other users’ load times. This is yet another step on our path toward providing a progressively decoupled eCommerce solution for the community to build robust experiences for merchants and consumers.

Categories: Drupal

Lullabot: Quick Tip: Add a Loading Animation for BigPipe Content

1 August 2018 - 12:22pm

BigPipe is a technique pioneered by Facebook that’s used to lazy-load content into a webpage. From the user’s perspective, the “frame” of a webpage will appear immediately, and then the content will pop in place when it’s ready. BigPipe has been included as a module in Drupal core since 8.1.x, and is very simple— just enable the module.

On my latest project, I'm using it to lazy-load content that’s generated from a very slow API call. The functionality works great out of the box, but we noticed a user-experience problem where the end-user would see a big blank area while the API call was waiting on a response. This behavior made the website seem broken. To fix this, we decided to implement a simple loading animation.

Finding the CSS selector to attach the animation to wasn’t as simple as I hoped it would be.

Spoiler: Let’s see the code

Looking for the code, and not the process? The CSS selector to target is below. Note that you’ll want to qualify this within a parent selector, so the loader doesn’t appear everywhere.

.parent-selector [data-big-pipe-placeholder-id] { /* Loading animation CSS */ }

BigPipe’s placeholder markup is only one <span> element, which makes styling tricky. Luckily, we can make use of CSS pseudo-selectors to make a Facebook-style throbber animation.

Here is some Sass with easy-to-use variables:

$pulse-duration: 0.2s; $pulse-color: rebeccaPurple; @keyframes pulse-throbber { 0% { opacity: 1; transform: scaley(1); } 100% { opacity: 0.2; transform: scaley(0.5); } } [data-big-pipe-placeholder-id] { position: relative; display: block; margin: 20px auto; width: 6px; height: 30px; background: $pulse-color; animation: pulse-throbber $pulse-duration infinite; animation-delay: ($pulse-duration / 3); animation-direction: alternate; &:before, &:after { content: ''; position: absolute; display: block; width: 100%; height: 100%; background: $pulse-color; top: 0; animation: pulse-throbber $pulse-duration infinite; animation-direction: alternate; } &:before { left: -12px; } &:after { left: 12px; animation-delay: ($pulse-duration / 1.5); } } Tracking down the placeholder’s CSS selector

Finding this selector wasn’t as simple as I initially hoped. The first technique that I tried was setting a DOM breakpoint in Chrome Developer Tools. This functionality allows you to pause the execution of JavaScript when a DOM element’s attributes change, the element gets removed, or any descendant DOM elements are modified.

In our case, we want to set a breakpoint when any descendant element is modified and then reload the page. Hopefully, when BigPipe inserts the rendered HTML, the breakpoint will trigger, and we can then inspect the placeholder HTML to find the appropriate CSS selector.

undefined

Unfortunately, this didn’t work. Why? I’m still not sure. This appears to be a bug within Google Chrome. I created an issue within the Chromium bug tracker and will update this article when there’s progress.

PHP Breakpoints to the rescue!

Because I know I’m using the BigPipe module to stream the content in, the next step is setting a PHP breakpoint within the BigPipe module within PHPStorm. I ended up setting a breakpoint within the sendContent() function within BigPipeResponse.php. This had the expected result of pausing the lazy-loading of the content, which enabled me to easily inspect the HTML prior so I could find the placeholder’s selector.

undefinedundefined Conclusion

Sometimes a seemingly simple theming task ends up being tricky. It’s important to understand proper front-end and backend debugging techniques because you never know when you’re going to need them in a pinch. Hopefully, this article will save someone from having to go through this process.

Photo by Jonny Caspari on Unsplash

Categories: Drupal

Pages