Editorial workflow head-to-head: Paragraphs vs Entity Embed vs Panelizer

Posted by Mediacurrent on March 14, 2017 at 7:23pm
Mediacurrent's NEDCamp 2015 Recap

In the world of content management systems, a major anxiety for editorial staff is whether their site is going to allow them to easily build complex pages. With today's demand for editorial workflows and internationalization, this problem gets even more complex. Add Drupal's Lego-like architecture to the mix and there can be a huge array of options for a site builder or architect to consider.

DrupalCon Schedule and BoF Sign-Ups are Live!

Posted by DrupalCon News on March 14, 2017 at 6:48pm

DrupalCon will begin before you know it. But you can plan your schedule today! There'll be more than 150 sessions, three keynotes, an unforgettable pre-note, and some important community conversations happening all week.

Making Drupal upgrades easy forever

Posted by Drupal blog on March 14, 2017 at 4:16pm

Republished from buytaert.net, please post your comments there.

The promise of making Drupal upgrades easy

One of the key reasons that Drupal has been successful is because we always made big, forward-looking changes. As a result, Drupal is one of very few CMSes that has stayed relevant for 15+ years. The downside is that with every major release of Drupal, we've gone through a lot of pain adjusting to these changes. The learning curve and difficult upgrade path from one major version of Drupal to the next (e.g. from Drupal 7 to Drupal 8) has also held back Drupal's momentum. In an ideal world, we'd be able to innovate fast yet provide a smooth learning curve and upgrade path from Drupal 8 to Drupal 9. We believe we've found a way to do both!

Upgrading from Drupal 8.2 to Drupal 8.3

Before we can talk about the upgrade path to Drupal 9, it's important to understand how we do releases in Drupal 8. With the release of Drupal 8, we moved Drupal core to use a continuous innovation model. Rather than having to wait for years to get new features, users now get sizeable advances in functionality every six months. Furthermore, we committed to providing a smooth upgrade for modules, themes, and distributions from one six-month release to the next.

This new approach is starting to work really well. With the 8.1 and 8.2 updates behind us and 8.3 close to release, we have added some stable improvements like BigPipe and a new status report page, as well as experimental improvements for outside-in, workflowslayouts, and more. We also plan to add important media improvements in 8.4.

Most importantly, upgrading from 8.2 to 8.3 for these new features is not much more complicated than simply updating for a bugfix or security release.

Upgrading from Drupal 8 to Drupal 9

After a lot of discussion among the Drupal core committers and developers, and studying projects like Symfony, we believe that the advantages of Drupal's minor upgrade model (e.g. from Drupal 8.2 to Drupal 8.3) can be translated to major upgrades (e.g. from Drupal 8 to Drupal 9). We see a way to keep innovating while providing a smooth upgrade path and learning curve from Drupal 8 to Drupal 9.

Here is how we will accomplish this: we will continue to introduce new features and backwards-compatible changes in Drupal 8 releases. In the process, we sometimes have to deprecate the old systems. Instead of removing old systems, we will keep them in place and encourage module maintainers to update to the new systems. This means that modules and custom code will continue to work. The more we innovate, the more deprecated code there will be in Drupal 8. Over time, maintaining backwards compatibility will become increasingly complex. Eventually, we will reach a point where we simply have too much deprecated code in Drupal 8. At that point, we will choose to remove the deprecated systems and release that as Drupal 9.

This means that Drupal 9.0 should be almost identical to the last Drupal 8 release, minus the deprecated code. It means that when modules take advantage of the latest Drupal 8 APIs and avoid using deprecated code, they should work on Drupal 9. Updating from Drupal 8's latest version to Drupal 9.0.0 should be as easy as updating between minor versions of Drupal 8. It also means that Drupal 9 gives us a clean slate to start innovating more rapidly again.

Why would you upgrade to Drupal 9 then? For the great new features in 9.1. No more features will be added to Drupal 8 after Drupal 9.0. Instead, they will go into Drupal 9.1, 9.2, and so on.

To get the most out of this new approach, we need to make two more improvements. We need to change core so that the exact same module can work with Drupal 8 and 9 if the module developer uses the latest APIs. We also need to provide full data migration from Drupal 6, 7 and 8 to any future release. So long as we make these changes before Drupal 9 and contributed or custom modules take advantage of the latest Drupal 8 APIs, up-to-date sites and modules may just begin using 9.0.0 the day it is is released.

What does this mean for Drupal 7 users?

If you are one of the more than a million sites successfully running on Drupal 7, you might only have one more big upgrade ahead of you.

If you are planning to migrate directly from Drupal 7 to Drupal 9, you should reconsider that approach. In this new model, it might be more beneficial to upgrade to Drupal 8. Once you’ve migrated your site to Drupal 8, subsequent upgrades will be much simpler.

We have more work to do to complete the Drupal 7 to Drupal 8 data migration, but the first Drupal 8 minor release that fully supports it could be 8.4.0, scheduled to be released in October 2017.

What does this mean for Drupal developers?

If you are a module or theme developer, you can continually update to the latest APIs each minor release. Avoid using deprecated code and your module will be compatible with Drupal 9 the day Drupal 9 is released. We have plans to make it easy for developers to identify and update deprecated code.

What does this mean for Drupal core contributors?

If you are a Drupal core contributor and want to introduce new improvements in Drupal core, Drupal 8 is the place to do it! With backwards compatibility layers, even pretty big changes are possible in Drupal 8.

When will Drupal 9 will be released?

We don't know yet, but it shouldn't matter as much either. Innovative Drupal 8 releases will go out on schedule every six months and upgrading to Drupal 9 should become easy. I don't believe we will release Drupal 9 any time soon; we have plenty of features in the works for Drupal 8. Once we know more, we'll follow up with more details.

Thank you

Special thanks to Alex Bronstein, Alex Pott, Gábor Hojtsy, Nathaniel Catchpole and Jess (xjm) for their contributions to this post.

How to integrate Google Analytics with Drupal 8

Posted by InternetDevels on March 14, 2017 at 2:51pm
How to integrate Google Analytics with Drupal 8

Probably, the first place among web analytics services belongs to Google Analytics, which is the most widely used on the Internet now. You can apply Google Analytics in content marketing, in social media marketing, in e-mail marketing and almost anywhere. This feature-rich tool allows you evaluate the effectiveness of your current campaigns and find smart marketing solutions for future.

Read more

How to integrate Google Analytics with Drupal 8

Posted by InternetDevels on March 14, 2017 at 2:51pm
How to integrate Google Analytics with Drupal 8

Probably, the first place among web analytics services belongs to Google Analytics, which is the most widely used on the Internet now. You can apply Google Analytics in content marketing, in social media marketing, in e-mail marketing and almost anywhere. This feature-rich tool allows you evaluate the effectiveness of your current campaigns and find smart marketing solutions for future.

Read more

Why Drupal is Great for Business

Posted by Zivtech on March 14, 2017 at 1:00pm

With roughly 1.2 million websites using Drupal across the world, including marquee sites such as NBCUniversal and pharmaceutical giant Novartis, it’s clear that it’s a powerful content management system capable of supporting large organizations.

Drupal is a go-to choice for these institutions in part because of its reliance on open source software (OSS). Its source code is openly available for anyone to use and contribute to, which is actually one of its greatest strengths.

When making your organization’s software choices in the past, you may have glazed over any mentions of whether the code was open or closed source. But specifically choosing open source can have a number of benefits for your business, and beyond that, choosing Drupal can provide your business with the powerful platform it needs to succeed.

Why Open Source?

Lower Cost

The majority of open source software is freely distributed, meaning there’s a huge cost benefit when you choose open over closed software. Open source tools also don’t restrict the number of users due to licensing. If your business chooses to use open source, you’ll never have to pay for additional licenses as your company grows. Just add user accounts and go.


Security is one of open source software’s greatest strengths. OSS is constantly under peer review by a community of experts, all of whom count on the same source code to keep their businesses running securely and efficiently. With a multitude of eyes on every project, open source tools are always checked and rechecked for security vulnerabilities. Problems often surface immediately thanks to the large number of users and contributors who maintain the code. You can sleep well at night knowing that your site is safe and secure.


There’s no barrier to entry with open source software. Anyone who wants to use it can get started for free. As a result, there’s an incredibly diverse population of individuals and businesses who use it. Open source is the foundation for all kinds of digital projects, making it more likely that someone has already created a tool for exactly what you want to accomplish.

This means more flexibility in the tools you use, and in the ability to add more tools. OSS grows and changes rapidly as people use it to accomplish all sorts of different goals.

No Vendor Lock-in

The accessible nature of OSS generally means that there are a large number of vendors that work with it. As a business, you have more options when looking for a partner for a digital project. If you need a new vendor for any reason, you’ll be able to find one who already knows the ins and outs of the software that you’re building with.

Why Drupal?


The Drupal community has more than one million members and more than 100,000 of these members actively contribute to its code. A passionate and active community aims to ensure that Drupal and its code base are up to the highest standards. A dedicated security team has steps in place to ensure that insecure code isn’t distributed to the public. You want passionate people as the brains behind your website, and Drupal has thousands of them.


Drupal is comprised of its core code, which includes basic features and functionality, and thousands of additional modules. Modules are blocks of code that extend the functionality of Drupal’s core. Developers can add functionality to a site by installing an existing module, or by creating a customized one to accomplish what they need.

Modules add a lot of power to the development process. You can customize your website to your specific needs, something that isn’t possible with other content management systems. Among others, there are modules that allow you to quickly navigate to specific administrative pages, create slideshows, and add web forms. Check out our list of some of our favorites.

Third Party Integration

Drupal gets along really well with third party applications. These integration capabilities allow for less complicated workflows and more flexibility. A single solution that integrates the tools you already use, like MailChimp and Salesforce, greatly improves productivity and reduces headaches.

Open Source Optimized

Drupal boasts all of the benefits of open source software and amplifies them. The contributing community is one of the strongest open source communities. Contributors follow incredibly stringent coding standards to ensure that the code works, and that it works well. Security vulnerabilities are stopped before they happen. Plus, with such a wide variety of organizations already running their sites on Drupal, it’s hard to argue that it’s not a great choice for your business too.

Loading and Rendering Modal Forms in Drupal 8

Posted by Mediacurrent on March 14, 2017 at 12:07pm
Modal Forms In Drupal 8

Modal dialogs are great and provide a great experience for the end user - they allow for quick display of content in an overlay without navigating to another page. Getting forms to load and render properly in a modal can sometimes be a little tricky, but fortunately, it’s relatively straightforward to implement in Drupal 8.

We will be setting up a custom form containing a button that opens up another form in a modal using Drupal’s FormBuilder and AJAX API. So, let’s get started!

Using Drupal Configuration Management to build an app

Posted by Aurelien Navarre on March 14, 2017 at 11:34am

There's a lot to say about Drupal Configuration Management. Many contrib modules have emerged to address the shortcomings in core and I agree that most of them are clearly solving a need. I even have colleagues claiming "there's a CM-related article every week on Drupal Planet!". Here's one more :-)

Still, I'm trying to work with what core has to offer unless forced to do otherwise. And you can already do a ton. Seriously. What I think is crucial with CM is the possibility to 'productize' or 'featurize' a site's configuration. Think building an app from scratch through automation. Think SaaS. Put differently, it's all about being able to build a specific feature (e.g. content type, form/view mode, etc.) and ship it to any other D8 instance.

Yes, the idea here is not to solve the dev to stage to prod deployment issues but to primarily spin up a new D8 dev instance and configure it like a full-featured application. And core does that very well out of the box.

Building the app

Back in 2014 when I started learning D8 and built a PoC of a REST-based D8 endpoint, I had to wipe my test site almost daily and create it from scratch again as core was constantly changing. Then I realized CM was perfect for this use case. Back then I had to work around UUID issues. Allow a site to be installed from existing configuration demonstrates our headache isn't over just yet. But the concept was essentially the same as it is today:

  • Spin up a new D8 instance
  • Enable all required contrib/custom modules/themes
  • Export your site's configuration
  • Version-control your CM sync directory
  • Add all CM files under version control
  • Build a simple feature (e.g. content type)
  • Export your site's configuration
  • Copy the new/modified files for later use (thanks git diff)
  • Add all new/modified CM files under version control
  • Rinse & repeat

With this simple workflow, you'll be able to incrementally build a list of files to re-use when building a new D8 instance from scratch. Oh, and why would we even bother creating a module for that? This works great as it is, granted you'll be extra careful (TL;DR use git) about every change you make.

Spinning up a new app

To test setting up your app, the workflow then becomes:

  • Spin up a new D8 instance
  • Enable all required contrib/custom modules/themes
  • Export your site's configuration
  • Version-control your CM directory
  • Add all CM files under version control
  • Copy your previously backed up configuration files to the sync directory
  • Import your new configuration

Looking back to how life was before Drupal 8, you will likely not disagree this is much better already. Here's an example for building an app from scratch. All of this could obviously be scripted.

$ cd /path/to/sync/dir
$ for i in module1, module2, module3, module4, module5 ; do drush @site.env en -y $i ; done
$ drush @site.env cex -y
$ git init
$ git add --all && git commit -m "Initial configuration"
$ cp /path/to/configuration/backup/*.yml .
$ git status
$ drush @site.env cim -y
$ git add --all && git commit -m "New configuration"

Now, here's a real-life example, summarized through the bit we're interested in: building the app from scratch through config-import.

$ drush @d8.local cim -y
    Config                                           Operation                                                                                             
    field.storage.node.field_inline_client              create 
    field.storage.node.field_email                      create 
    field.storage.node.field_address                    create 
    node.type.client                                    create 
    field.field.node.client.field_email                 create 
    field.field.node.client.field_address               create 
    core.base_field_override.node.client.title          create 
    node.type.contract                                  create 
    field.field.node.contract.field_inline_client       create 
    core.base_field_override.node.contract.title        create 
    core.base_field_override.node.contract.promote      create 
    field.storage.paragraph.field_unit                  create 
    field.storage.paragraph.field_reference             create 
    field.storage.paragraph.field_quantite              create 
    field.storage.paragraph.field_price                 create 
    field.storage.node.field_service                    create 
    field.field.node.contract.field_service             create 
    core.entity_form_display.node.contract.default      create 
    paragraphs.paragraphs_type.service                  create 
    field.field.paragraph.service.field_unit            create 
    field.field.paragraph.service.field_reference       create 
    field.field.paragraph.service.field_quantite        create 
    field.field.paragraph.service.field_price           create 
    field.storage.node.field_telephone                  create 
    field.field.node.client.field_telephone             create 
    core.entity_form_display.node.client.default        create 
    field.storage.paragraph.field_description           create 
    field.field.paragraph.service.field_description     create 
    core.entity_view_display.paragraph.service.default  create 
    core.entity_form_display.paragraph.service.default  create 
    core.entity_view_display.node.contract.teaser       create 
    core.entity_view_display.node.contract.default      create 
    core.entity_view_display.node.client.default        create 
    user.role.editor                                    create 
    system.action.user_remove_role_action.editor        create 
    system.action.user_add_role_action.editor           create 
    auto_entitylabel.settings                           create
Import the listed configuration changes? (y/n): y  
 [notice] Synchronized configuration: create field.storage.node.field_inline_client.
 [notice] Synchronized configuration: create field.storage.node.field_email.
 [notice] Synchronized configuration: create field.storage.node.field_address.
 [notice] Synchronized configuration: create node.type.client.
 [notice] Synchronized configuration: create field.field.node.client.field_email.
 [notice] Synchronized configuration: create field.field.node.client.field_address.
 [notice] Synchronized configuration: create core.base_field_override.node.client.title.
 [notice] Synchronized configuration: create node.type.contract.
 [notice] Synchronized configuration: create field.field.node.contract.field_inline_client.
 [notice] Synchronized configuration: create core.base_field_override.node.contract.title.
 [notice] Synchronized configuration: create core.base_field_override.node.contract.promote.
 [notice] Synchronized configuration: create field.storage.paragraph.field_unit.
 [notice] Synchronized configuration: create field.storage.paragraph.field_reference.
 [notice] Synchronized configuration: create field.storage.paragraph.field_quantite.
 [notice] Synchronized configuration: create field.storage.paragraph.field_price.
 [notice] Synchronized configuration: create field.storage.node.field_service.
 [notice] Synchronized configuration: create field.field.node.contract.field_service.
 [notice] Synchronized configuration: create core.entity_form_display.node.contract.default.
 [notice] Synchronized configuration: create paragraphs.paragraphs_type.service.
 [notice] Synchronized configuration: create field.field.paragraph.service.field_unit.
 [notice] Synchronized configuration: create field.field.paragraph.service.field_reference.
 [notice] Synchronized configuration: create field.field.paragraph.service.field_quantite.
 [notice] Synchronized configuration: create field.field.paragraph.service.field_price.
 [notice] Synchronized configuration: create field.storage.node.field_telephone.
 [notice] Synchronized configuration: create field.field.node.client.field_telephone.
 [notice] Synchronized configuration: create core.entity_form_display.node.client.default.
 [notice] Synchronized configuration: create field.storage.paragraph.field_description.
 [notice] Synchronized configuration: create field.field.paragraph.service.field_description.
 [notice] Synchronized configuration: create core.entity_view_display.paragraph.service.default.
 [notice] Synchronized configuration: create core.entity_form_display.paragraph.service.default.
 [notice] Synchronized configuration: create core.entity_view_display.node.contract.teaser.
 [notice] Synchronized configuration: create core.entity_view_display.node.contract.default.
 [notice] Synchronized configuration: create core.entity_view_display.node.client.default.
 [notice] Synchronized configuration: create user.role.editor.
 [notice] Synchronized configuration: create system.action.user_remove_role_action.editor.
 [notice] Synchronized configuration: create system.action.user_add_role_action.editor.
 [notice] Synchronized configuration: create auto_entitylabel.settings.
 [notice] Finalizing configuration synchronization.
 [success] The configuration was imported successfully.

If the import was successful, reload your site and observe everything shows up like magic: site configuration, content types, custom fields, view/form modes, module configuration, views, etc.

Sure you could argue that doing so is very prone to errors, but remember that a) it's primarily for development needs and b) you need to version-control all of this to be able to go back to the last working commit and revert if necessary.

Wrapping up

Two other use cases I very much like are:

  • When I want to demonstrate an issue, I can simply share some files for someone else to import and quickly reproduce the issue with little efforts and no room for configuration mismatch.
  • When building a new feature (e.g. a Flag and a View), I can do so in dev, then export only the files I need, and import in stage or prod when I'm ready.

Building an app will obviously take much more than that but, as I hear more and more frustration about how Configuration Management was designed, I thought I'd set the record straight on how it solves my biggest problems when developing an app.

252: Mumbai Memories: Taking Drupal 8 from awesome to super-awesome - Neetu Morwani

Posted by Acquia Developer Center Blog on March 14, 2017 at 10:40am
DrupalCon Asia Mumbai logo

Taking Drupal 8 from awesome to super-awesome with Neetu Morwani.

My trusty microphone, camera, and I recorded a few great conversations in Mumbai that have never been released until now. Next up in “Mumbai Memories”, taking Drupal 8 from awesome to super-awesome with Neetu Morwani!

Neetu landed a Drupal-related job right after graduation, as she explains: "Accidentally, I started working in Drupal." In the nearly four years since then, she has become an enthusiastic member of the community and made a lot of code contributions to Drupal (thank you, Neetu!). She's now a Drupal developer at Acquia's New Delhi office and was a speaker at DrupalCon Asia in Mumbai. Listening to Neetu talk about the significance of DrupalCon coming to India, how it is changing people's lives in India, her excitement is palpable. This energy was everywhere at DrupalCon in Mumbai. The Indian Drupal community is a wonderful (large!) group of men and women who are bursting with energy and ideas about how to improve the world.

DrupalCon Asia Mumbai 2016 was almost exactly a year ago now. Of all the conferences I have been to, Mumbai was probably my favorite. I met an incredible, active, enthusiastic Drupal community that welcomed everyone with open arms, incredible food (!), and a LOT of selfies :-)

Neetu Morwani

Subscribe to the podcast!

Subscribe to the Acquia Podcast in iTunes and rate this episode!

Subscribe via our RSS feed.

Skill Level: BeginnerIntermediateAdvanced

AGILEDROP: Other Top Drupal Blogs from February

Posted by Agiledrop.com Blog on March 14, 2017 at 8:52am
Again late maybe, but besides our blog activities in February, we still owe you the work from the other authors. So, here's are the best Drupal blogs from February that were not written by us. We'll start our overview with Tim Mallezie and his Porting Drupal 7 modules to Drupal 8. A lot has been said that many modules are not properly converted to Drupal 8. So, the author explains, how to properly import modules from Drupal 7 to Drupal 8. In addition, he explained one of his approaches which he tested on one of his modules. You can read the full blog post here. Our second choice is Dries… READ MORE

Creating content blocks programmatically in Drupal 8

Posted by TimOnWeb.com on March 13, 2017 at 11:14pm

Let's picture this: you've created a custom content block type (let's say, Ad block) in your shiny new Drupal 8 installation and you want to automaticaly create a fresh new block of that type each time you create a taxonomy term (Ad group), so that every ad group has a ...

Read now

251: Mumbai Memories — Ujval Shah

Posted by Acquia Developer Center Blog on March 13, 2017 at 8:49pm
DrupalCon Asia Mumbai logo

My trusty microphone, camera, and I recorded a few great conversations in Mumbai that have never been released until now. So let's get started with a little thing I’m calling “Mumbai Memories”.

Meet Ujval Shah from the state of Gujarat in India. He’s been doing and evangelizing Drupal for a long time — he’s worked with every version of Drupal from 4.6 to 8! Ujval was part of the first-ever Indian Drupal Camp in Ahmedabad in 2008, and he’s been generously speaking, training, and contributing to open source software for a decade.

DrupalCon Asia Mumbai 2016 was almost exactly a year ago now. Of all the conferences I have been to, Mumbai was probably my favorite. I met an incredible, active, enthusiastic Drupal community that welcomed everyone with open arms, incredible food (!), and a LOT of selfies :-)

Why Your Drupal Web Development Shop Should Contribute to Drupal 8

Posted by Acquia Developer Center Blog on March 13, 2017 at 4:44pm
give back graphic

After 2½ years, Chapter Three in San Francisco is reaping the rewards from its early commitment to Drupal 8.

Tags: acquia drupal planet

How to Build a Drupal 8 Scrolling Text Slideshow

Posted by OSTraining on March 13, 2017 at 4:43pm
How to Build Drupal 8 Scrolling Text Slideshow

An OSTraining member asked us how to create a CNN / BBC-style news site, with a breaking news ticker. 

In this tutorial, I'll show you how to build a slideshow in Drupal 8 that uses text rather than images.

If you're using Drupal 7, we have a version of this tutorial for you.

DrupalCon Baltimore: Learn how to delight your customers

Posted by Drupal Association blog on March 13, 2017 at 2:24pm

Join us at DrupalCon Baltimore from April 24-28 for a week of inspiration, networking, and learning. Meet Drupal experts and industry leaders who will share new ways to create digital experiences that delight customers, citizens, students, patients, and more.

The event offers programming for decision makers (CIO/Director) as well as digital teams (developers, project managers, site builders, content strategists). Be sure to check out these suggested sessions for both audiences.

Top Five Reasons To Attend DrupalCon
  • Get inspired! Hear Dries Buytaert’s vision for digital transformation and Drupal.
  • Network with peers at 4 industry summits and case study sessions on Bluecross Blueshield, Cornell University, Mass.gov, NBA, Quicken, YMCA, and more.
  • Level up your team's skill with 10 trainings and 161 sessions taught by Drupal masters.
  • Find solution partners. Visit the exhibit hall to meet Drupal’s robust vendor ecosystem.
  • Be Amazed. Meet the open source community that powers Drupal.

Register today. Prices increase March 24th. Attendees can come for the week or just for a day. Plus, the Baltimore Convention Center is easy to reach - just 30 minutes from Baltimore Washington Airport and 15 minutes from the Amtrak Station.

We look forward to seeing you at DrupalCon Baltimore!

Drupal 8 security features: SQL injection

Posted by MD Systems blog on March 13, 2017 at 10:40am
Recently, we had to create a security report for one of our clients about their Drupal 8 project. We described how Drupal 8 protects against most common vulnerabilities and added some project specific tests to secure as good as possible that it cannot be attacked. This resulted in a document that we thought is worth to be transferred into a series of blog posts.

Executing Drupal Console commands on a project with DrupalVM using vagrant-exec plugin

Posted by jmolivas.com on March 13, 2017 at 8:20am
Executing Drupal Console commands on a project with DrupalVM using vagrant-exec plugin

I am currently working on a project where we are using DrupalVM as composer dependency.

Since ssh into the VM machine to execute commands could be a little cumbersome, and providing a site configuration file to take advantage of the --target option to execute commands remotely was not an option, because the generate commands can not be executed remotely if you want to use the interactive mode.

My options got narrowed to execute vagrant ssh and run commands within the VM (which I already mentioned I am not a big fan) or take advantage of the vagrant-exec plugin.

I decided to give a try to the vagrant-exec plugin and this what you need to do to use it in your project when DrupalVM is required via composer.

Install plugin

Execute plugin install command.

jmolivas Mon, 03/13/2017 - 08:20

More Complex Services Using Factories in Drupal 8

Posted by Web Omelette on March 13, 2017 at 7:57am

The Symfony service container that Drupal 8 ships with allows us to define a large number of services (dependency objects) that we can inject in our controllers, forms, plugins, other services, etc. If you don't know about dependency injection yet, you can read more about it here. In this article we will look at how we can use our own factory class to instantiate a service via the Symfony - Drupal 8 service container.

The typical (barebones) service definition consists of a class name to be instantiated and an array of arguments to be passed to its constructor as it gets created (other service definitions or static parameters). For more information, check out the documentation on services.

In some cases, though, we would like our service to be built dynamically based on certain contextual conditions, such as the current user. The implication is also that we don’t rely on the service container for the actual object instantiation, but our own factory class. We do still want to benefit from most of what the container offers us, such as caching.

Let’s see a very simple example. Imagine a UserContextInterface which can have multiple implementations. These implementations depend on some value on the current user account (such as role for instance). And we want to have a service we can inject into our other objects which implements this interface but which is also the representation of the current user. Meaning it is an implementation specific to it (not always the same class).

We can go about achieving this in two ways:

  • We can have a Factory class we define as a simple service (with the current user as an argument), use this as our dependency and then always ask it to give us the correct UserContextInterface.
  • We can have a Factory class we define as a service (with the current user as an argument) but use it in the definition of another service as a factory and rely on the container for asking it for the UserContextInterface.

The first option is pretty self-explanatory and not necessary in our case. Why should we keep asking the user context at runtime (the process to determine the context can be quite complex) when we can have that cached for the duration of the request. So let’s instead see how the second option would work:

    class: Drupal\my_module\UserContextFactory
    arguments: ['@current_user']
    class:  Drupal\my_module\UserContextFactory
    factory: 'my_module.user_context_factory:getUserContext'

So these would be our service definitions. We have the factory which takes the current user as an argument, and the user context service which we will be injecting as our dependency wherever we need. The latter uses our factory’s getUserContext() method to return the relevant UserContextInterface implementation. It is not so important what class we set on this latter service because the resulting object will always be the result of the factory.

The rest is boilerplate and we won’t be going into it. However, what needs to happen next is create our UserContextFactory class which takes in the AccountProxyInterface representing the current user and which implements the getUserContext() method tasked with building the UserContextInterface implementation. The latter method is not bound to any return type by the service per se, however, we must ensure that we return a UserContextInterface  in every case to preserve the integrity of our application. One good practice to ensure this is creating a UserContextNone implementation of UserContextInterface which would be returned by the factory in those edge cases when the context cannot be determined or values are missing, etc.

So that is pretty much it on how and why you would or can use a factory instantiation of services from your container. There is nothing new here, in fact the Symfony documentation has an entry specifically about this. However, I believe it’s a neat little trick we should all be aware of.

DrupalCamp London, my first keynote.

Posted by Matt Glaman on March 12, 2017 at 9:14pm

is, according to various sources and rumors, the biggest camp in Europe. It comes up in size next to BADCamp and DrupalCamp Mumbai, coming in the 400 to 600 attendee range. That is quite a feat, and I am honored to have gotten to experience this DrupalCamp.

In January I was asked to be one of the keynotes. After a mini jump around and freak out, I, of course, said yes. Then I had a moment of "what in the world am I going to talk about." I've presented at camps before, and I have been able to copresent at the past two DrupalCons about Drupal Commerce alongside Ryan and Bojan.

But a keynote can't just be another "here's Drupal Commerce" or "Here's how this development process goes!" To me, at least, I look at keynotes to plant a seed of motivation that gets me kicked in gear for the conference. It reminds me of why I was excited to go to the camp and see all these amazing people again.

This was my first keynote. It was my first time going to London. It was my second time going to Europe, following up to DrupalCon Dublin. Two known names in the Drupal and open source community were slated as the Sunday keynotes. I spoke on Saturday, the mood setter. I guess a slight panic can describe my mentality at first.

So, I sat and I thought. And then I remembered the . How he highlighted Drupal changing lives. And I thought, "well, Drupal sure as hell did make some changes my life." So I wanted to tell my story. Drupal opened opportunities for me and I made some lucky choices at the right place and time. That made me think: what if I shared my story and how open source, specifically Drupal, made this impact. Maybe it'd catch a handful of newcomers in the crowd and inspire them like many people did at my first DrupalCamp in Atlanta.

So I shared my story. I showed how the progression of finding Drupal, becoming part of the community, and having the community support provided a career and very big changes in my life.

Five years ago I was slinging half barrels, full of dyed green beer for St. Patricks day, into bar basements. Four years ago I built my first major Drupal (via Drupal Commerce) site. Three years ago I got to speak at DrupalCamp Florida. Two years ago I went to my first DrupalCon in Los Angeles. Now I'm here, shocked and awed at this journey which is only beginning.

The conference was great. The organization was spot on, great venue and session rooms. Unfortunately, I did not catch any other sessions. Right after the keynote, I hit the sprint room to finish up my slides and wrap up some pull requests. Right after lunch, . And right afterward gave his . Then it was party / social time!

I think we also rocked the social night pub just a bit. We drained them of Guinness and spent over £5000. Granted, some of that was food. Well, maybe a little. 

It was a great camp. I am more than looking forward to attending it once more.

Lessons Learned from 2+ Years of Using Behat

Posted by Stanford Web Services Blog on March 12, 2017 at 5:39pm

At the 2017 Stanford Drupal Camp, I facilitated a conversation about "Lessons Learned from 2+ Years Using Behat".

Check out the video of the session here.


Subscribe with RSS Subscribe to Drupal.org aggregator - Planet Drupal