A tutorial on migrating basic data to a Drupal 8 site using the migrate module and related modules.read more
The Drupal node access grants system has been more or less unchanged since the beginning. However, with Drupal 8, we can and should start leveraging the OOP and service oriented architecture for things like this.
This module defines a simple interface which needs to be implemented by a tagged service in order to play with access grant system, namely the hook_node_grants() and hook_node_access_records() implementations.
Drupal 8.0.0 replaced the earlier, in-place upgrade procedure for major version upgrades with a migration-based solution for core and contributed modules. Several modules serve this need in core: The Migrate module provides a general API for migrations, the Migrate Drupal module provides API support for Drupal-to-Drupal migrations, and the Migrate Drupal UI module offers a simple user interface to run migrations from older Drupal versions.
A lot of work has gone into making migrations more complete since the initial 8.0.0 release, including for multilingual sites with various configurations. Drupal-to-Drupal migrations are still not wholly complete (especially for Drupal 7 sources). However, lots of real-life use has validated the choices we made with the base Migrate API, and key architectural improvements have been completed already. An increasing number of contributed modules rely on it for their migrations.
Based on this stability and success, the Migrate subsystem maintainers and Drupal release managers have agreed the Migrate API (the Migrate module) now has beta stability! The change took effect in Drupal 8.2.x with 8.2.5 and will apply to 8.3.0 onwards as well.What does this mean for sites and developers relying on the Migrate API?
Beta experimental modules are considered API- and feature-complete and beta modules are subject to the beta allowed changes policy. This means that module and migration developers can rely on the API remaining stable from now on! This also means that the focus with Migrate API is on fixing critical issues as well as bug fixes and contributed project blockers, if they are non-disruptive, or if the impact outweighs the disruption.
Note that Migrate Drupal and Migrate Drupal UI are still alpha stability, so API changes may still happen in these modules. Completing the Drupal-to-Drupal migration path and getting Migrate Drupal to beta stability is the next priority, so your help with missing and incomplete migrations is welcome!
If you want to get involved, the migration team is meeting every week at alternating times. The team has Google Hangouts at Wed 1pm UTC or Thu 1am UTC on an alternating weekly schedule. The #drupal-migrate IRC channel is also used as a backchannel.
2017 is going to be an incredible year for SooperThemes and for you! We kick off with the first official major version update for our drag and drop builder! Today we introduce you to Glazed Builder 1.1.0. We have rebranded Carbide Builder to Glazed Builder and developed some major new features, including entity revisions, full support for filtered contextual views and RGBA color sliders!
This is a monumental update. Glazed Builder is currently not only the greatest and fastest drag and drop builder for Drupal but also a very competitive product in the wider site building landscape. Going forward we'll not only develop more features and designs but we'll also start developing even more complete and complex turn-key Glazed demos. In addition this release marks the start of our Drupal 8 upgrade sprint. Yes, you heard that right, with the D8Media initiative aiming to add much needed Media improvements in Drupal 8.3 we feel like now is the right time.Try Glazed Builder Now
The Admin demo is free, no card required!Redesigned for 2017
Glazed Builder has a fresh look that is designed for fast intuitive site-building. The speed of an interface isn't just about fast code, it's very much about fast design too. The new controls are all-white and while animation is used on the drop shadows the actual controls appear and respond immediately.
The colors and branding are matched to the Glazed brand, to emphasize the uniform experience you get when you combine our Glazed Theme with the builder. That said, Glazed Builder is still an independent module that can work with any Drupal theme!Views with Contextual Filters
Perfect if you're making a magazine website or more serious blog or commerce website! Now you can design taxonomy term or e-commerce pages with dynamic views displays. It is now fully supported to load views in drag and drop pages, override their filters and pagers in Glazed Builder, and let these views take default arguments based on url parts.
This feature is not just awesome for magazine websites but also for government websites, intranets, communities... Basically anyone who builds websites with large amounts of structured content will love this update.Better Equal Heights Rows And Vertical Centering, RGBA Color
Having an alpha slider on every color setting in Glazed Builder allows more creative freedom for designers and makes it easier for site builders to implement designs that use translucent elements. We also improved equal heights rows by replacing the old jQuery trick with faster, reliable Flexbox CSS. In addition we enriched the column element with a Vertical Centering option. This let's you add vertical centering to columns independently of sibling columns.Saving Revisions
Some updates are invisible: Glazed Builder now automatically detects entity types that support revisions and will create new revisions when saving to fields on these entities. It doesn't matter if your field is on a node, bean block or custom entity. It doesn't even matter if you have have 10 Glazed Builder instances in one page, saving to multiple entities in the backend. It all just works and with revisions you'll easily undo those regrettable changes that seemed right in the spur of the moment. Goole AMP
Google AMP is seeing more and more adoption and we integrated Glazed Builder with the Drupal AMP module. AMP is very restrictive so it won't allow fancy elements like circle charts and image comparison widgets but it should work fine with non-interactive markup generated by Glazed Builder. We welcome feedback from AMP experts on how to further extend AMP support!Glazed Theme 2.6.0
While this releases focuses on the Glazed Builder update, Glazed Theme also received new features and consequently a major version bump to 2.6.0. Less spectaculary but still very useful: A Import/Export interface was added to the Glazed Theme Settings interface. All those settings that collectively make up your sites' unique design can now easily be copy-pasted between environments, or into a new subtheme .info file.Drupal 8 Themes and Builder
As a subscription Drupal theme shop, we really focus on building long-term relationships with our customers and that's why we carefully chose important moments that affect the products we make and maintain. Choosing the right moment to make the D8 move was hard, because Drupal 7 is just so good that it was hard for Drupal 8 to take the crown.
From my perspective, this moment is the release of Drupal 8.3 with contrib in great shape, improved media handling, and hopefully a media browser in core! The moment that it no longer makes sense for anyone to start a Drupal 7 website is approaching and we're going to make sure all our products are running smoothly on Drupal 8 by that time.
For more details about this update:
The Admin demo is free, no card required!
In Part 1, I talked about using Google Docs + Migrate to populate your site. Now we’re going to do that with the Migrate Google Sheets module. Below, I’ll provide the steps to get your own migration up and running, but if you prefer to experiment with a working example, check out a demo of the Migrate Google Sheets Example module (provided as a submodule within Migrate Google Sheets). All content on that site was built using this example Google Sheet.Setup: Install the Module
If you’ve already got a Drupal 8 site up and running, you can install the module in any of the normal ways. I’m assuming here that you have access to the site using Drush, as it’s not possible to run migrations through anything but the command line at this time. At ThinkShout, we use composer to build our site distributions, and have a repo for building the demo site here.Step 1: Creating Your Custom Migration Module
The easiest way to get started on your own set of migrations is to copy the migrate_google_sheets_example submodule and rename it something of your own. Let’s say we rename it “my_migration.” Follow these steps:
- Rename your .install file to “my_migration.install”, and change the function migrate_google_sheets_example_uninstall to “my_migration_uninstall”.
- Delete the helper submodule “migrate_google_sheets_example_setup” entirely – that is just necessary to build the content types required for the example module, but you shouldn’t need it for your migration module.
- Rename your migrate_google_sheets_example.info.yml as “my_migration.info.yml” and open it up. At the very least, you’ll want to change the name of the migration to “name: my_migration” but you’ll also likely wish to remove the migrate_google_sheets:migrate_google_sheets_example_setup dependency. Mine ended up looking like this:
When completed, your module structure should look like this:
You are now ready to enable your My Migrations module. (Make sure you disable the migrate_google_sheets_example module first, if you’d previously enabled that!)Step 2: Create Your Spreadsheet
Assuming you have the Game and Landing page content types, you could now run the migrations in your “My Migrations” module and it will pull the data from the Google Sheet.
But since you don’t have permissions to edit that sheet, you’re going to need to copy the existing sheet and create your own to do any customizations.
When this is done, you’ll get a url like this:
https://docs.google.com/spreadsheets/d/YourLongHashIDHere where YourLongHashIDHere is your feed key.
Now you’ll need to publish your new spreadsheet. This is an option under “File” -> “Publish to the web”
To verify that your migration module will be able to see the Google sheet, try opening an anonymous browser window and visiting the Feed version of the url, whose format is this:
If visiting that URL throws out a bunch of json, you’re ready to start migrating!
But of course, your current set of migration files still point to the old feed. In the my_migrations/config/install folder, you’ll need to find all instances of our feed string (1spS1BeUIzxR1KrGK2kKzAoiFZii6vBHyLx_SA0Sb89M) and replace them with your feed string.Step 3: Decide Which Migrations to Keep
The Migrate Google Sheets Example module provides one Migration Group (games_example) and 6 Migrations. Depending on your site configuration, some of these might be useful, like the menu_links and the blocks migrations, and some of them will not be so useful (like the node_game migration, likely). This is a good time to trim or modify any migrations that aren’t going to be useful for your Drupal site. That being said, here are a few things that the sample migrations demonstrate:
- Block UUIDs: When you place a block using the Block Layout screen, the block’s UUID is saved in config. If you’re running a migration over and over, your block’s ID will iterate on its own, but the UUID can remain constant if you add it to the migration. In the demo site, this allows us to create a persistent CTA block in the header.
- Menu Links parents: You can specify that a menu link item has a parent from within the current migration. This lets us say /bohnanza and /hanabi are children of /games
- Page and Game redirects: These sheets demonstrate how to add the redirect from the url of content on an old site to the new home right in the content sheet. Try going to https://live-mgs-demo.pantheonsite.io/that-fireworks-game and see where you end up.
- Related content as strings or ids: On the Page sheet, we have a reference to the “Related games” for the given page. This is an entity reference which we could fill with a couple of things. We could refer to the ID of the related games, as they are stored in the Games sheet, or we could do what we’ve done here and use the migrate_plus plugin “entity_lookup” to search for the related game node by name. As long as there is a Game node called Bohnanza, we’ll always link to the right one. This is particularly useful with Term references, where the name of the item ideally remains constant.
- Game downloadable file: Games have associated images, which are files hosted externally to the spreadsheet. In order to relate my game content to its image, I need to download the image, get it into the file_managed database table (creating a file entity) and THEN relate that entity to the current node. This is done with the following lines in the “node_games” migration:
You can keep as many or as few of the migration files as you’d like. You can also create new ones.Step 4: Tell Drupal About Your Changes
Drupal 8 only sees the changes you’ve made to your migration yml files when you first install the module. That means that you need to uninstall and reinstall the module to make new changes show up. ThinkShout has a Robo script that does this, but the same thing can be done in Drush:drush mr --all # Rolls back all migrations drush pmu my_migration -y # Disables my migration module drush en my_migration -y # Enable my migration module drush ms # Displays my current migration status
You can also string these together as one line:drush mr --all && drush pmu my_migration -y && drush pmu my_migration -y && drush ms Step 5: Run your migrations
This part is simple. To run all migrations, it’s a quick drush command:
drush mi --all
If you’d like to find out about all the possible options for the migrate-import command, you can run
drush help mi
You can also see your list of migration groups at /admin/structure/migrate, and you can review your migrations by clicking “List Migrations.” The resulting page will give you the same output, more or less, that you get from running a drush ms.
These pages are helpful to know about, as they give you an easy place to find errors logged during the migration process. However, you can’t currently run a migration from the UI (although there is an issue for this).Gotchas
But before we close, I do want to acknowledge some challenges we’ve seen in this approach.
Sad fact #1: HTML in a spreadsheet is ugly.
Google Spreadsheets don’t let you make your rows smaller than the number of line breaks in a cell. So if you have pretty html with a bunch of line breaks, your row might be too tall to fit on your screen. People have some clever workarounds for this, but so far we’ve not implemented any.
Sad fact #2: Sheet order matters (right now)
Maintaining the order of sheets isn’t top on everyone’s minds as they’re making changes to a spreadsheet, especially when duplicating tabs. Migrate Google Sheets asks for each sheet based on tab order. If I make a copy of the Page tab, the Game tab is now the fourth tab instead of the third tab.
As it stands now, the module will happily request columns that don’t exist on the third tab and then fail in puzzling ways.
There is currently only one issue in the issue queue for the Migrate Google Sheets module, and it’s to fix this.
Sad fact #3: Google sheets must be publicly viewable to work (again, right now)
As the module exists right now, there’s no authentication involved, so any migrated content must be publicly viewable. Google authorization is possible with Oauth2, but that is not currently implemented.Conclusion
A very simple module to enable image fields for rotation. It will display a small Clockwise icon with uploaded image in node creation form.
It also works with Amazon S3 and S3FS modules.
In 2016, our team worked on a sponsored contrib module, GatherContent. The goal of the project was to recreate the module for Drupal 7 using best practices, and to create a brand new module for Drupal 8.
This module provides the WeChat Pay integration for Drupal Commerce 2 on Drupal 8. This module is till under active development, please do not use it for production yet until a stable release.Features:
- QR Code Payment
This module also require additional PHP libraries. To use this module, you need to:
1. Add the Drupal.org repository
This video tutorial was made for our customer in order to demonstrate how to build a custom view to extract the data they need.
Here we are building a view to extract sales data per project where each project is classified into a category. We link invoice table with project table and add filter to be able to view data by year and category of project.
The tables and data sources used in this view are custom tables from our back office management solution built on Drupal 8. However, the principles of building a view are applicable to any other data source and this tutorial can be used to learn simple view building with tables relationships and filter.
Your browser doesn't support HTML5 video tag.
After migrating an older Drupal 6 site with 20,000 media items to Drupal 8, I found a strange problem with image uploads. On the Drupal site, using Image FUpload and Adobe Flash, I could upload up to 99 images in one go. On the new Drupal 8 site, I was only able to upload 20 images, even though I didn't see an error message or any other indication that the rest of the images I had selected through the Media Image upload form were not successfully added.
I could choose 21, 40, or 500 images, but only 20 were ever added to an album at any time.
There were no apparent warnings on the screen, so I just assumed there was some random bug in the Media Image Entity or Media module suite that limited uploads to 20 files at a time.
But due to an unrelated error, I glanced at the PHP logs one day, and noticed the following error message:
I was starting my weekly work for the Drupal GraphQL module by the customary composer update --prefer-source -vvv command, ready to watch composer spit out some hundred lines sipping my coffee, but this time something turned out to be wrong:[...snip...]
The "https://packages.drupal.org/8/drupal/provider-2016-4%24a30289dd8394e5271bd77777bb14b361c5938656f1cddad7fae1c00d5d6ba9c6.json" file could not be downloaded (HTTP/1.1 404 Not Found)
OK, so packages.drupal.org is down for now. How can we work around this ?
This module provides facilities for user agent resource hints.
Please see https://www.w3.org/TR/resource-hints/ for more details.
* dns-prefetch, preconnect, and prefetch, prerender link elements
* x-dns-prefetch-control meta element
* HTTP header alternative to link elements by each type
This comprehensive guide is intended to help get you started when developing a governance plan for your institution’s digital communications.In this guide we will cover...
- What digital governance is
- Why digital governance is important
- What topics you need to think about when building out a digital governance plan
We want to make your project a success.Let's Chat.
Download the guide here.
Stay connected with the latest news on web strategy, design, and development.Sign up for our newsletter.
Drupal 8.3 is still a few months away, coming April 5, 2017, but there are already some changes we can look at, most notably in the experimental modules. In December, 2 new experimental modules were added to core, and BigPipe was officially changed from a beta module to stable. The 2 new modules you'll find in 8.3 are Workflows and Layout. Let's take a peek at what these are all about.
In this five-part series, every Monday in January we’ll explore a New Year’s resolution and how it can apply to your web project.
We want to make your project a success.Let's Chat.
Unless you’re Marie Kondo of the KonMari Method and make your living organizing, you likely have a few messes somewhere. Photo albums? That pile of books? Year-end taxes and receipts? (‘Tis almost the season for that too.)
When it comes to your online space, here are a few tips we can offer on how to get organized for 2017:
- Strategy Matters: How to Start a Successful Project
- Project Kickoffs That Work
- Writing an RFP to Attract the Right Response
- Addressing Accessibility for the Web
- Planning for Long-Term Success on the Web
Lastly, if you want a comprehensive look at how to get your internal governance in order, check out our detailed guide on digital governance (37 page PDF). The ownership, management, and sustainability plan for an organization’s various digital communications platforms seems simple at a distance, but the devil is in the details.
Next week’s resolution: stay fit and healthy.
Let Palantir help you get organized.
We'd love to help you keep your 2017 resolution.Let's chat.
When I was a kid, my siblings and I used to play with Mad Libs. If you aren’t familiar with them, Mad Libs are basically one-page stories or vignettes, with various words missing. Where those words should be are blanks, and each blank is labeled “noun” or “verb” or whatever type of word should be filled in.
One project I'm working on needed a Behat test added to test whether a particular redirection works properly. Basically, I wanted to test for the following:
- An anonymous user accesses a file at a URL like http://www.example.com/pictures/test.jpg
- The anonymous user is redirected to the path http://www.example.com/sites/default/files/pictures/test.jpg
Since the site uses Apache, I added the actual redirect to the site's .htaccess file in the docroot, using the following Rewrite configuration:<IfModule mod_rewrite.c>
# Rewrite requests for /profile_images to public files directory location.
RewriteRule ^ pictures/(.*)$ /sites/default/files/pictures/$1 [L,NC,R=301]
Testing with curl --head, I could see that the proper headers were set—Location was set to the correct redirected URL, and the response gave a 301. So now I had to add the Behat test.
I'm releasing a new series today!!!!!
Over the last year, I've given a talk at DrupalCon, DrupalCorn Camp, and Drupal Camp Colorado all about using Composer and Configuration Management in Drupal 8. Those sessions were around 45 minutes, which is much too short to go in depth, and explain everything thoroughly.
There is just over 1hr 15min of content in 26 videos that fall pretty well into seven parts. Here's the outline:Part 1: Intro
- Creating a New Drupal 8 Project Using the Composer Template
- Setting Up MAMP to Serve Your Site Locally
- Using xip.io for Local Device Testing
- Creating a Drush Alias
- Installing Drupal with Console
- Configuring settings.php and settings.local.php
- Committing Your Project to Git
- Installing and Uninstalling Modules with Composer
- Installing the Dev Version of Modules
- Updating and Downgrading Modules
- Skipping Specific Module Versions
- Specifying Acceptable Version Ranges
- Enabling Modules with Drush and Deciding What Version Pattern to Use
- Setting the Config Directory in settings.php
- Exporting Config Locally
- Using the Configuration Installer Install Profile
- Installing the Site on a Production Server with Composer
- Setting up settings.local.php
- Changing the Site Name and Disabling CSS Aggregation in settings.local.php
- How to Enable Theme Debugging on Development Sites
- Overriding Module Configuration (Like Google Analytics) in settings.local.php
- Configuring a Local Site and Exporting it's Configuration with Git
- Pulling Changes to a Remote Site (And some gotchas)
- Using Drush Shell Aliases to Make Development Easier
- Verifying the Changes Made on Local and Reflected on Live
I'm pretty excited to finally have this series out, and hope you enjoy it! Oh... did I mention that it's ABSOLUTELY FREE?!?! Well, it is! So, check it out now, and let me know what you think.Tags: Drupal 8ComposerConfiguration ManagementLocal DevelopmentDrushGitShell-Aliasesplanet-drupal