Four Kitchens: Performance at DrupalCon New Orleans

Planet Drupal - ma, 2016/05/02 - 7:04pm

With DrupalCon New Orleans right around the corner, Web Chef Emeritus Ian Carrico wanted to share some of the front-end performance sessions that will be featured during DrupalCon.

Categorieën:

myDropWizard.com: Connect with myDropWizard at DrupalCon New Orleans!

Planet Drupal - ma, 2016/05/02 - 7:04pm

Next week Drupalers from all around the world we be descending on the beautiful city of New Orleans for DrupalCon 2016 - and myDropWizard will be there too!

If you've never been to a DrupalCon - you're missing out. It's an opportunity to meet the Drupal people you know virtually, be surrounded by a dizzying amount of Drupal knowledge, and get inspired and excited for the future of Drupal. Watching the videos is great, but I'd argue that you can learn more by asking someone in the hallway or attending a sprint.

Anyway, there's lots of great articles about why you should attend DrupalCon - I'm not going to attempt to rehash that all here. :-)

But if you're coming, I am going to try and encourage you to connect with myDropWizard while you're at DrupalCon New Orleans!

Both myself (David Snopek) and myDropWizard co-founder, Elliot Christenson, will be there. If you're interested in ...

... then come and find us!

Categorieën:

Urban Insight: Redesigning a site as a long-term project

Planet Drupal - ma, 2016/05/02 - 6:00pm

One of the earliest sites developed by Urban Insight is planetizen.com. It still remains one of biggest sites that we actively develop and maintain. When the site was upgraded from Drupal 5 to 7 a few years back we had to plan and implement a full content migration. That is, we built a brand new Drupal 7 site from scratch and migrated all data and settings from the Drupal 5 site.

Categorieën:

Sooper Drupal Themes: Drupal Drupal CMS 1.0 and Glazed Premium 2.4.8 Arrived: Cool New Features and Better Views Integration

Planet Drupal - ma, 2016/05/02 - 5:48pm

Glazed Drupal CMS 1.0

After over 100 git commits over 4 weeks, including weekends and late nights I can present to you Glazed 2.4.8. This release includes not only an update to the premium Drupal theme and the drag and drop builder: the Glazed Drupal CMS distribution on drupal.org finally reached the 1.0 milestone! The backend distribution started as an experiment 2 years ago. I tried to find the perfect bundle of features to jump-start development of Drupal CMS websites.After nearly 100 beta releases I finally settled on the formula for features and flexibility that is now in the Glazed Drupal CMS 1.0 release. To make the distribution truly useful, it of course had to have a beautiful theme, and the distro now includes a free slimmed down version of our best-selling Glazed framework theme: Glazed Free.

Glazed Drupal CMS 1.0 Features
  • Fully Loaded WYSIWYG Editor
  • Built In Media Library
  • Glazed Free Theme included
  • Multilevel Responsive Main Menu
  • Blog Content & Views
  • Portfolio Content & Views
  • Event Content & Views
  • Event Registration
  • News Content & Views
  • Bootstrap 3 integrated
  • SEO Optimized
  • Demo Content Included

    Glazed Drupal CMS on Drupal.org

    Glazed 2.4.8 Comes with a ton of improvements, bug fixes and shiny new demo pages!

    Glazed 2.4.8 Release Highlights

    Search all the things!

    Full screen search is a really exciting new UI feature in Glazed. Search is becoming a key factor in navigation on increasingly large and dynamic websites. Thanks to our full screen search design you can provide a unified search experience no mobile and desktop. The search feature is based on Drupal's core search, with just a theming and behavioral overlay by Glazed. This means you can use all your favorite search modules and plugins along with our full screen UI.

    We added this search enhancement with the goal of powering larger, more dynamic sites. If you have any ideas to further improve our search be sure to hit the comments! (One thing I'm looking at is using the Fast Autocomplete fac module).

    View Full Screen Search demo

    Stunning Animations At Your Fingertips

    It has never been easier to create stunning animations. We added a new demo page to to showcases our newly added floating animation. This page is also great for learning how you can use animations and apply in your own projects. If you are interested in our improved animation features check out the animation page. If you want to try the animation engine, to spin up a private demo at trysooperthemes.com.

    My goal at SooperThemes is to strike a balance between features, performance, and usability. I actually cut the animate.css library in half, because it had some many animations that are just ridiculous and have no place in a professional product. I then added the custom floating animation for our new Apple style demo page and the whole animation library clocks in at just 4kb. It only loads on pages with animations, because we care about performance.

    View Animation Demo Page

    Enjoy easy animations for callouts, meaningful content enhancement or simply to impress your client or improve website visitor engagement. Or just for fun, but don't overdo it.

    GridStack Views: Stack Your Featured Content

    We've been working on features that will be used for our future Magazine designs for Glazed. This is one of them. Using the GridStack JS library and our easy to use Views integration, you can create dynamic "stacks" of your most important content. The views plugin gives you total control over layout, gap size, colors, all inside the Views module. You can use it for homepage headers, footers, or even for a full-page gridstack with all your content!

    This is one of those little features that make your content more fun to interact with, and more personalized.

    Creating custom stacks:

    View GridStack Module Page

      Carousels For All Content

    There are 2 kinds of sliders in our Carbide Builder drag and drop tool. This first is a Bootstrap based simple image slider. Then There is the Carousel Element, which is like a swiss army knife of sliders. It will do regular sliders, fading sliders, carousels, and more. It will slide anything you throw at it, including videos, images, and HTML content with layouts.

    The Carousel element gives you the awesome power of the Owl Carousel library at your fingertips. Here is an example slider that I created by copying the Position Elements container demo contet in 2 slides:

    View Carousel Demo Page

    View Positioned Layers Demo Page

     

      Improving Drupal Views Integration

    The most exciting improvements in 2.4.8 to me are all in the Views integration. We tested and improved exposed filter integration. The awesome power of views' exposed filters and sorting is that unlike with contextual filters you get a human-friendly form that allows you to personalize the view. When exposing a category filter, you get a nice hierarchical selectbox to choose a category. When you want to expose  something more massive like a node:author field you can use an autocomplete field.

    The power of views integration will become more obvious when we start release magazine designs for Glazed. Keep an eye on the blog/newsletter!

    New Pages in the Glazed 2.4.8 Main Demo

    All new and updated demo pages:

    For a complete list of changes check out the Glazed and Carbide Builder changelogs:

    CHANGELOG Glazed Theme
    CHANGELOG Carbide Builder

    Improving Drupal's Distribution Experience

    Since Distribtuions were announced as a feature for Drupal I thought it was a great idea, and now SooperThemes is working on making distributions even better. I think we are the first distribution to have a custom build option but that is just the beginning. We are currently testing Auto-Deploy & Install tools that we've been working on for 4 months. (Think fully automatic deployment and installation on your server or even shared hosting).

    Bonus GIF

    Here's a GIF image of our completely re-architected multi-level responsive main menu:

    Limited Time Offer


    Active for a very limited time!

    Join SooperThemes Today!

    To upgrade your existing account click your subscription in the sooperthemes.com toolbar and choose Add Plan or Change Plan.

    Have a great day!

    Categorieën:

    Drupal Association News: Make it official with your certificate of membership

    Planet Drupal - ma, 2016/05/02 - 5:07pm

    Today we begin our first membership campaign of the year. It’s all about making your contribution official with a personalized certificate of membership.

    In our 4th year of running this campaign, we hope that you will help us by either joining the Drupal Association or by letting others know about this opportunity. Members who join or renew from now through June 30 will be sent a certificate. Our goal is to send 675 certificates, which is a 10% increase from last year’s final count.

    Make it official

    It wouldn’t be fun if we did not have some challenge for our members, however. So here it is: if you refer 5 or more members to us during this campaign, we will give you a shoutout on this blog and on Twitter. If your company refers 5 or more members during the campaign, we’ll publicly acknowledge your company as well. (When you refer someone, tell them they can mention you when they sign up.)

    We love the creativity of the Drupal community and we look forward to seeing how you share about this campaign. If you are a member and you want your certificate so you can do something fun like this, just ask and we’ll send it to you.

    Thank you! RT @DJRitendra: @DrupalAssoc Glad To be part of #DrupalAssoc :) #Drupal @DJRitendra pic.twitter.com/fVaBA5MGPI

    — Drupal Association (@DrupalAssoc) June 3, 2015

    Thanks for your support! RT @GambinoVin: My Certificate of membership! @DrupalAssoc @brightlemon pic.twitter.com/CyFqhgZNZF

    — Drupal Association (@DrupalAssoc) June 12, 2015

    Personal blog tags: Membership
    Categorieën:

    Larry Garfield: Moving to a new Platform

    Planet Drupal - ma, 2016/05/02 - 4:02pm

    After my last post, a number of people asked if I was leaving Drupal all together. Perish the thought. :-) However, after a decade at Palantir.net and the five-year Wagnerian Saga that was the Drupal 8 development cycle (complete with singing), I have been asking myself "What next?"

    Well, what do I like to do? I like to build. I like to teach. I like to make things better. I like to work with smart people, as colleagues, as community partners, and as customers. I want to be able to have an impact in making something better for other people.

    To that end, I am pleased to announce that today is my first day as Director of Runtimes, Integrations, and Services for Platform.sh.

    read more

    Categorieën:

    Drupalize.Me: Dig into Drupal 8 at DrupalCon

    Planet Drupal - ma, 2016/05/02 - 3:15pm

    DrupalCon is almost here and it’s time to start filling out your schedule. There’s a lot to do and see (not to mention eating lots of great New Orleans food!), so we definitely recommend having at least a rough game plan for how to use your time. Here’s a look at things you should be considering, especially if you are looking to take away a lot of Drupal 8 knowledge.

    Categorieën:

    Flocon de toile | Freelance Drupal: Drupal 8 : Inject a contact form inside a content type in 5 steps

    Planet Drupal - ma, 2016/05/02 - 3:07pm

    How to insert a contact form inside a content Drupal 8? Or on a specific page in a specific location ? By default, contact forms created have a dedicated page. But if we want to use them elsewhere. After some research, I almost thought I should write a few lines of code to create a specific Plugin.

    But contact forms, like almost everything now in Drupal 8, are entities. Finally, place a contact form, or any other form besides, is a simplicity that had eluded me until now.

    Categorieën:

    DrupalEasy: DrupalEasy Podcast 174 - Floss Belt (Ryan Szrama - Drupal Commerce)

    Planet Drupal - ma, 2016/05/02 - 2:02pm

    Direct .mp3 file download.

    Ryan Szrama (rszrama), President and CEO of Commerce Guys, project leader of Drupal Commerce, and proud ex-Best Buy Geek Squad member joins Ryan, Ted, and Mike for a comprehensive discussion Commerce Guys' recent relaunch as a standalone company, and the current development progress of Drupal Commerce for Drupal 8. We also discussed Drupal 8.1, a potential future for the theme layer, the absolute correct pronunciation of "Szrama", and a big announcement from Ted.

    Interview DrupalEasy News Three Stories Sponsors Picks of the Week Upcoming Events Follow us on Twitter Five Questions (answers only)
    1. Kayaking
    2. Clash Royale
    3. Become a beverage professional
    4. Llamas
    5. DrupalCon Barcelona 2007
    Intro Music

    The Dean Scream.

    Subscribe

    Subscribe to our podcast on iTunes, Google Play or Miro. Listen to our podcast on Stitcher.

    If you'd like to leave us a voicemail, call 321-396-2340. Please keep in mind that we might play your voicemail during one of our future podcasts. Feel free to call in with suggestions, rants, questions, or corrections. If you'd rather just send us an email, please use our contact page.

    Categorieën:

    Dries Buytaert: Handling context in "outside-in"

    Planet Drupal - ma, 2016/05/02 - 11:28am

    In a recent post we talked about how introducing outside-in experiences could improve the Drupal site-building experience by letting you immediately edit simple configuration without leaving the page. In a follow-up blog post, we provided concrete examples of how we can apply outside-in to Drupal.

    The feedback was overwhelmingly positive. However, there were also some really important questions raised. The most common concern was the idea that the mockups ignored "context".

    When we showed how to place a block "outside-in", we placed it on a single page. However, in Drupal a block can also be made visible for specific pages, types, roles, languages, or any number of other contexts. The flexibility this provides is one place where Drupal shines.

    Why context matters

    For the sake of simplicity and focus we intentionally did not address how to handle context in outside-in in the last post. However, incorporating context into "outside-in" thinking is fundamentally important for at least two reasons:

    1. Managing context is essential to site building. Site builders commonly want to place a block or menu item that will be visible on not just one but several pages or to not all but some users. A key principle of outside-in is previewing as you edit. The challenge is that you want to preview what site visitors will see, not what you see as a site builder or site administrator.
    2. Managing context is a big usability problem on its own. Even without outside-in patterns, making context simple and usable is an unsolved problem. Modules like Context and Panels have added lots of useful functionality, but all of it happens away from the rendered page.
    The ingredients: user groups and page groups

    To begin to incorporate context into outside-in, Kevin Oleary, with input from yoroy, Bojhan, Angie Byron, Gábor Hojtsy and others, has iterated on the block placement examples that we presented in the last post, to incorporate some ideas for how we can make context outside-in. We're excited to share our ideas and we'd love your feedback so we can keep iterating.

    To solve the problem, we recommend introducing 3 new concepts:

    1. Page groups: re-usable collections of URLs, wildcards, content types, etc.
    2. User groups: reusable collections of roles, user languages, or other user attributes.
    3. Impersonation: the ability to view the page as a user group.
    Page groups

    Most sites have some concept of a "section" or "type" of page that may or may not equate to a content type. A commerce store for example may have a "kids" section with several product types that share navigation or other blocks. Page groups adapts to this by creating reusable "bundles" of content consisting either of a certain type (e.g. all research reports), or of manually curated lists of pages (e.g. a group that includes /home, /contact us, and /about us), or a combination of the two (similar to Context module but context never provided an in-place UI).

    User groups

    User groups would combine multiple user contexts like role, language, location, etc. Example user groups could be "Authenticated users logged in from the United States", or "Anonymous users that signed up to our newsletter". The goal is to combine the massive number of potential contexts into understandable "bundles" that can be used for context and impersonation.

    Impersonation

    As mentioned earlier, a challenge is that you want to preview what site visitors will see, not what you see as a site builder or site administrator. Impersonation allows site builders to switch between different user groups. Switching between different user groups allow a page to be previewed as that type of user.

    Using page groups, user groups and impersonation

    Let's take a look at how we use these 3 ingredients in an example. For the purpose of this blog post, we want to focus on two use cases:

    1. I'm a site builder working on a life sciences journal with a paywall and I want to place a block called "Download report" next to all entities of type "Research summary" (content type), but only to users with the role "Subscriber" (user role).
    2. I want to place a block called "Access reports" on the main page, the "About us" page, and the "Contact us" page (URL based), and all research summary pages, but only to users who are anonymous users.

    Things can get more complex but these two use cases are a good starting point and realistic examples of what people do with Drupal.

    Step #1: place a block for anonymous users

    Let's assume the user is a content editor, and the user groups "Anonymous" and "Subscriber" as well as the page groups "Subscriber pages" and "Public pages" have already been created for her by a site builder. Her first task is to place the "Access reports" block and make it visible only for anonymous users.


    First the editor changes the impersonation to "Anonymous" then she places the block. She is informed about the impact of the change.

    Step #2: place a block for subscribers

    Our editor's next task is to place the "Download reports" block and make it visible only for subscribers. To do that she is going to want to view the page as a subscriber. Here it's important that this interactions happens smoothly, and with animation, so that changes that occur on the page are not missed.


    The editor changes the impersonation to "Subscribers". When she does the "Access reports" block is hidden as it is not visible for subscribers. When she places the "Download report" block and chooses the "Subscriber pages" page group, she is notified about the impact of the change.

    Step #3: see if you did it right

    Once our editor has finished step one and two she will want to go back and make sure that step two did not undo or complicate what was done in step one, for example by making the "Download report" block visible for Anonymous users or vice versa. This is where impersonation comes in.


    The anonymous users need to see the "Access reports" block and subscribers need to see the "Download report" block. Impersonation lets you see what that looks like for each user group.

    Summary

    The idea of combining a number of contexts into a single object is not new, both context and panels do this. What is new here is that when you bring this to the front-end with impersonation, you can make a change that has broad impact while seeing it exactly as your user will.

    Categorieën:

    Janez Urevc: Media entity reaches 8.x-1.0!

    Planet Drupal - ma, 2016/05/02 - 10:00am
    Media entity reaches 8.x-1.0! slashrsm Mon, 02.05.2016 - 10:00

    More than two years ago I gave a session about the future of media at DrupalCon Prague. The outcome of that session was a planning sprint that happened two days after it. One of the ideas that was born on that sprint was Media entity, storage layer for media-related information built with simplicity and support for remotely hosted media in mind. It's development started shortly after that and got significantly accelerated in the spring of the next year, when the core of the media initiative met at NYC Camp and agreed on the common battle plan for Drupal 8.

    Media entity and it's plugins have been pretty stable for the last few months. It seemed to be almost ready for it's first release, but there were few tickets in the issue queue which I wanted to resolve first. In the last few days I found some time to look at those. Together with Tadej Baša (@paranojik) we managed to finish all of the most important patches, which allowed me to tag 8.x-1.0 yesterday. I am thrilled and extremely proud. A lot of individuals and organizations invested many hours to make this possible and I would like to thank every single one of them. Special thanks go to NYC Camp organizers, who organized two sprints and have been supporting us from the beginning, Examiner.com, my ex employer who allowed me to spend significant amount of my time to work on many media-related modules and MD Systems, who organized two media sprints and let part of their team to work on Drupal 8 media for 3 months.

    Along with the main module I released some of it's plugins too: Image, Slideshow, Twitter and Instagram. There are also plugins that handle Video, Audio and Documents, which are also quite ready to be used.

    Media entity and it's plugins offer many interesting features:

    • simple and lean storage for local and remote media,
    • out of the box integration with standard Drupal's tools,
    • pluggable architecture that allows easy implementation of additional plugins,
    • 100% automatic delivery of thumbnails,
    • delivery of remote metadata and
    • mapping of remote metadata with entity fields.

    I encourage you to try it and let us know what you think. We are looking for co-maintainers too. If you'd like to spend some time in contrib and have ideas for new features let me know.

    In the next few weeks we're planning releases of the other media modules. Stay tuned!

    Categorieën:

    Valuebound: Profiling Drupal Performance with Webgrind and Xdebug

    Planet Drupal - ma, 2016/05/02 - 9:25am

    Xdebug Profiling is all about measuring the performance of PHP code.


    Here we go!

    Requirements:

    1. Xdebug, with profiler enabled
    2. Webgrind
    3. Xdebug Addon plugin for browser

    1. Xdebug with profiler enabled

    For setting up the environment, edit the php.ini file and add following lines.

    xdebug.profiler_enable_trigger = 1

    If you want the cachegrind in a prefered location, then add the following

    xdebug.profiler_output_dir="/var/www/html/xdebug_profiler"

    If you want a prefered name, add below line of code

    xdebug.profiler_output_name="cachegrind.out.%u.%H_%R"

    Once added, restart the web…

    Categorieën:

    Amazee Labs: Amazee Labs launches Drupal Hoster amazee.io

    Planet Drupal - ma, 2016/05/02 - 9:14am
    Amazee Labs launches Drupal Hoster amazee.io

    Today’s the day to reconsider your hosting. We are launching amazee.io, a state-of-the-art hosting service with an integrated development and hosting environment. Think of a battle-proven system, automated deployments, full congruence between your development and productive environment, and a very competitive pricing.

    “Why another Drupal hosting provider?” You might ask. Read why: stories.amazee.io 

    Johanna Bergmann Mon, 05/02/2016 - 09:14

    And if you have not yet on seen our website or factsheet let me introduce the team behind the system: Michael Schmid (Schnitzel), CTO; Tyler Ward and Bastian Widmer for DevOps, and myself, who after three great years at the Drupal Association accepted the opportunity to lead the new venture as CEO. We are excited!

    Hope to see you at the upcoming DrupalCon in New Orleans.

    Categorieën:

    Red Route: Including SVG icons in a Drupal 8 theme

    Planet Drupal - zo, 2016/05/01 - 10:46am

    I got started with task runners a while ago using Grunt, thanks to an excellent 24 ways article by Chris Coyier. Lately I've been using Gulp more, and all the cool kids seem to be going that way, so for the Drupal 8 version of The Gallery Guide, I've decided to use Gulp.

    Since hearing Chris Coyier talk about SVG icon systems, I've been meaning to implement them in my own workflow. I've written about a similar setup for Jekyll on the Capgemini engineering blog, and wanted to apply something similar to this site.

    The Gulp setup for this project is almost identical to the one described in that post, so I won't go into too much detail here, but in the spirit of openness that's guiding this project, the gulpfile is on Github.

    In short, there's a directory of SVG icons within the theme, and there's a Gulp task to combine them into a single file at images/icons.svg. Then the contents of that file is injected into the page using a preprocess function. There's a slight gotcha here - if the value is added directly, without going through the t() function, then it automatically gets escaped to block cross-site scripting. It doesn't seem to make sense, according to the documentation, but I needed to pass the value in without any prefix character:

    function gall_preprocess_page(&$variables) { $svg = file_get_contents(drupal_get_path('theme', 'gall') . '/images/icons.svg'); $variables['svg_icons'] = t('svg', array('svg' => $svg)); }

    If we were working with user-supplied content, this would be opening up a dangerous attack vector, but given that it's content that I've created myself in the theme, it's safe to trust it.

    Having done that, in the page.html.twig template, the variable is available for output:

    {{ svg_icons }}

    Then these files can be referenced - here's a snippet from region--header.html.twig:

    <a href="https://www.twitter.com/thegalleryguide" title="Follow us on Twitter"> <svg class="icon"> <use xlink:href="#twitter"></use> </svg> </a>

    Part of me feels like there should be a more Drupal-ish way of doing this, so that the links are part of a menu. But given that this is my own project, and changing the icons would require a code change, it doesn't feel so bad to have them hard-coded in the template.

    Tags:  Drupal Drupal 8 The Gallery Guide All tags
    Categorieën:

    hussainweb.me: Drupal Meetup Bangalore – March and April 2016

    Planet Drupal - zo, 2016/05/01 - 6:25am
    Things have gotten busy after DrupalCon Asia which meant that the Drupal meetup we hold in Bangalore every month was a little difficult to organize. Srijan Technologies stepped up and offered their office space in Whitefield, Bangalore. They also took care of snacks and even lunch for all the attendees. Kudos to Srijan for organizing the meetup. Thank you!
    Categorieën:

    DrupalEasy: Drupal 6 to Drupal 8(.1.x) Custom Content Migration

    Planet Drupal - za, 2016/04/30 - 2:45pm

    Note: This blog post is based on Drupal 8.1.x. It is an updated version of a previous tutorial based on Drupal 8.0.x. While the concepts are largely the same as 8.0.x, a refactoring of the core migrate modules took place in Drupal 8.1.x (migrations will become plugins in 8.1.x). This updated tutorial updates the previous example to work with Drupal 8.1.x, as well as demonstrates how to specify a migration group and run the migration with Drush. If you're familiar with the previous tutorial, you may want to skip to the "Rolling up our sleeves" section below.

    Even if you're only casually acquainted with Drupal 8, you probably know that the core upgrade path to Drupal 8 has been completely rewritten from the ground-up, using many of the concepts of the Migrate and Drupal-to-Drupal migration modules. Using the Migrate upgrade module, it is possible to migrate much of a Drupal 6 (or Drupal 7) site to Drupal 8 with a minimum of fuss (DrupalEasy.com is a prime example of this). "Migrate upgrade" is similar to previous Drupal core upgrade paths - there are no options to pick-and-choose what is to be migrated - it's all-or-nothing. This blog post provides an example of how to migrate content from only a single, simple content type in a Drupal 6 site to a Drupal 8.1.x site, without writing any PHP code at all.

    Setting the table

    First, some background information on how the Drupal 8 Migrate module is architected. The Migrate module revolves around three main concepts:

    • Source plugins - these are plugins that know how to get the particular data to be migrated. Drupal's core "Migrate" module only contains base-level source plugins, often extended by other modules. Most Drupal core modules provide their own source plugins that know how to query Drupal 6 and Drupal 7 databases for data they're responsible for. For example, the Drupal 8 core "Node" module contains source plugins for Drupal 6 and Drupal 7 nodes, node revisions, node types, etc… Additionally, contributed and custom modules can provide additional source plugins for other CMSes (WordPress, Joomla, etc…), database types (Oracle, MSSQL, etc…), and data formats (CSV, XML, JSON, etc.)
    • Process plugins - these are plugins designed to receive data from source plugins, then massage it into the proper form for the destination on a per-field basis. Multiple process plugins can be applied to a single piece of data. Drupal core provides various useful process plugins, but custom and contributed modules can easily implement their own.
    • Destination plugins - these are plugins that know how to receive data from the process plugins and create the appropriate Drupal 8 "thing". The Drupal 8 core "Migrate" module contains general-purpose destination plugins for configuration and content entities, while individual modules can extend that support where their data requires specialized processing.

    Together, the Source -> Process -> Destination structure is often called the "pipeline".

    It is important to understand that for basic Drupal 6 to Drupal 8 migrations (like this example), all of the code is already present - all the developer needs to do it to configure the migration. It is much like preparing a meal where you already have a kitchen full of tools and food - the chef only needs to assemble what is already there.

    The configuration of the migration for this example will take place completely in two custom .yml files that will live inside of a custom module. In the end, the custom module will be quite simple - just a .info.yml file for the module itself, and two .yml files for configuring the migration.

    Reviewing the recipe

    For this example, the source Drupal 6 site is a large site, with more than 10 different content types, thousands of nodes, and many associated vocabularies, users, profiles, views, and everything else that goes along with an average Drupal site that has been around for 5+ years. The client has decided to rewrite the entire site in Drupal 8, rebuilding virtually the entire site from the ground-up - but they wanted to migrate a few thousand nodes from two particular content types. This example will demonstrate how to write a custom migration for the simpler of the two content types.

    The "external article" content type to be migrated contains several fields, but only a few of consequence:

    • Title - the node's title
    • Publication source - a single line, unformatted text field
    • Location - a single line, unformatted text field
    • External link - a field of type "link"

    Some additional notes:

    • The "Body" field is unused, and does not need to be migrated.
    • The existing data in the "Author" field is unimportant, and can be populated with UID=1 on the Drupal 8 site.
    • The node will be migrated from type "ext_article" to "article".

    Several factors make this a particularly straight-forward migration:

    • There are no reference fields at all (not even the author!)
    • All of the field types to be migrated are included with Drupal 8 core.
    • The Drupal 6 source plugin for nodes allows a "type" parameter, which is super-handy for only migrated nodes of a certain type from the source site.
    Rolling up our sleeves

    With all of this knowledge, it's time to write our custom migration. First, create a custom module with only an .info.yml file (Drupal Console's generate:module command can do this in a flash.) List the Migrate Drupal (migrate_drupal) and Migrate Plus modules as dependencies. The Migrate Drupal module dependency is necessary for some of its classes that contain functionality to query Drupal 6 databases, while the Migrate Plus module dependency is required because custom migrations are now plugins that utilize the MigrationConfigEntityPluginManager provided by Migrate Plus (full details in a blog post by Mike Ryan).

    Next, create a "migration group" by creating a migrate_plus.migration_group.mygroup.yml file. The purpose of a migration group is to be able to group related migrations together, for the benefit of running them all at once as well as providing information common to all the group migrations (like the source database credentials) in one place.

    The "shared_configuration -> source -> key" value of "legacy" corresponds to a database specified in the Drupal 8 site's settings.php file. For example:

    Next, create a new "migrate_plus.migration.external_articles.yml" file in /config/install/. Copy/paste the contents of Drupal core's /core/modules/node/migration_templates/d6_node.yml file into it. This "migration template" is what all node migrations are based on when running the Drupal core upgrade path. So, it's a great place to start for our custom migration. Note that the file name begins with "migrate_plus.migration" - this is what allows our custom migration to utilize the Migrate Plus module's MigrationConfigEntityPluginManager.

    There's a few customizations that need to be made in order to meet our requirements:

    • Change the "id" and "label" of the migration to something unique for the project.
    • Add the "migration_group: mygroup" to add this migration to the group we created above. This allows this migration access to the Drupal 6 source database credentials.
    • For the "source" plugin, the "d6_node" migration is fine - this source knows how to query a Drupal 6 database for nodes. But, by itself, it will query the database for nodes, regardless of their type. Luckily, the "d6_node" plugin takes an (optional) "node_type" parameter. So, we add "ext_article" as the "node_type".
    • We can remove the "nid" and "vid" field mappings in the "process" section. The Drupal core upgrade path preserves source entity ids, but as long as we're careful with reference fields (in our case, we have none), we can remove the field mappings and let Drupal 8 assign new node and version ids for incoming nodes. Note that we're not migrating previous node revisions, only the current revision.
    • Change the "type" field mapping from a straight mapping to a static value using the "default_value" process plugin. This is what allows us to change the type of the incoming nodes from "ext_article" to just "article".
    • Similarly, change the "uid" field mapping from a straight mapping to a static_value of "1", which assigns the author of all incoming nodes to the UID=1 user on the Drupal 8 site.
    • Since we don't have any "body" field data to migrate, we can remove all the "body" field mappings.
    • Add a mapping for the "Publication source". On the Drupal 6 site, this field's machine name is "field_source", on the Drupal 8 site, the field's machine name is field_publication_source. Since it is a simple text field, we can use a direct mapping.
    • Add a direct mapping for "field_location". This one is even easier than the previous because the field name is the same on both the source and destination site.
    • Add a mapping for the source "External link" field. On the Drupal 6 site, the machine name is "field_externallinktarget", while on the Drupal 8 site, it has been changed to "field_external_link". Because this is a field of type "link", we must use the "d6_cck_link" process plugin (provided by the Drupal 8 core "Link" module). This process plugin knows how to take Drupal 6 link field data and massage it into the proper form for Drupal 8 link field data.
    • Finally, we can remove all the migration dependencies, as none of them are necessary for this simple migration.

    The resulting file is:

    Note that .yml files are super-sensitive to indentation. Each indentation must be two spaces (no tab characters).

    Serving the meal

    To run the migration, first enable the custom module. The act of enabling the module and Drupal core's reading in of the migration configuration could trigger an error if the configuration isn't formatted properly. For example, if you misspelled the "d6_node" source plugin as "db_node", you'll see the following error:

    [Error] The "db_node" plugin does not exist.

    If the module installs properly, the Drush commands provided by the Migrate Tools (8.x-2.x-dev - 2016-Apr-12 or later) module can be used to manage the migration. First, use the Drush "migrate-status" command (alias: ms) can be run to confirm that the migration configuration exists. This is similar to functionality in Drupal 7's Migrate module.

    ~/Sites/drupal8migrate $ drush ms Group: mygroup Status Total Imported Unprocessed Last imported enternal_articles Idle 602 602 0 2016-04-29 16:35:53

    Finally, using Drush, the migration can be run using the "migrate-import" (alias: mi) command:

    ~/Sites/drupal8migrate $ drush mi external_articles Processed 602 items (602 created, 0 updated, 0 failed, 0 ignored) - done with 'external_articles'

    Similarly, the migration can be rolled back using the drush "migrate-rollback" (alias: rm) command:

    ~/Sites/drupal8migrate $ drush migrate-rollback external_articles Rolled back 602 items - done with 'external_articles'

    Once the migration is complete, navigate over to your Drupal 8 site, confirm that all the content has been migrated properly, then uninstall the custom module as well as the other migrate-related modules.

    Note that the Migrate module doesn't properly dispose of its tables (yet) when it is uninstalled, so you may have to manually remove the "migrate_map" and "migrate_message" tables from your destination database.

    Odds and ends
    • One of the trickier aspects about writing custom migrations is updating the migration configuration on an installed module. There are several options:
      • The Configuration development module provides a config-devel-import-one (cdi1) drush command that will read a configuration file directly into the active store. For example: drush cdi1 modules/custom/mymodule/config/install/migrate.migration.external_articles.yml
      • Drush core provides a config-edit command that allows a developer to directly edit an active configuration.
      • Finally, if you're a bit old-school, you can uninstall the module, then use the "drush php" command to run Drupal::configFactory()->getEditable('migrate.migration.external_articles)->delete();, then reinstall the module.
    • Sometimes, while developing a custom migration, if things on the destination get really "dirty", I've found that starting with a fresh DB helps immensely (be sure to remove those "migrate_" tables as well!)
    Additional resources

    Thanks to Mike Ryan and Jeffrey Phillips for reviewing this post prior to publication.

    Categorieën:

    hussainweb.me: Porting token module to Drupal 8

    Planet Drupal - za, 2016/04/30 - 6:50am
    Now, token is a module everyone needs and no one knows, especially after token is mostly in core since Drupal 7. How can that still be dev two months after Drupal 8 final?!
    Categorieën:

    Aten Design Group: Introducing Entity Query API for Drupal 8

    Planet Drupal - vr, 2016/04/29 - 10:26pm

    Drupal 8 lays the foundation for building robust and flexible RESTful APIs quickly and efficiently. Combine this with Drupal’s best-in-class fieldable entity model and it becomes incredibly easy to construct systems that solve many different problems well.

    Out of the box, Drupal 8 comes with core modules for all of the standard RESTful HTTP methods, GET, POST, PATCH, and DELETE. These endpoints are entity specific. Collection endpoints - endpoints that deal with entities in aggregate - are another story. The solution offered is the Views module.

    In a headless or API intensive site however, core Drupal 8 and Views are limited by a major shortcoming. Support for querying your entity content over an API is limited to only the custom views that you create. This means that you must first create a view for any content that you want to expose. Filtering is limited to only the filters you explicitly enable and there’s no clear solution for fine-grained control over sorting and paging your results via query strings - the common practice for RESTful APIs. This creates a lot of development overhead for headless and API intensive sites which will inevitably end up with innumerable views.

    Creating publicly available APIs would be worse yet. Typically, you would like a public API to allow your consumers to discover and access your data as they see fit. Managing each view for all your entity types becomes increasingly difficult with every new field added or new entity type. This issue makes sense, the Views module’s original intent was to provide prescribed aggregations of your content, possibly modified by a few contextual items like the current path or the current user. Views were never intended to be an all-purpose query tool for the end user.

    Enter Entity Query API. Entity Query API allows API consumers to make queries against any entity in Drupal. From users, to nodes, to configuration entities, this is an incredibly powerful tool. By creating a standardized set of parameters for crafting these queries, Entity Query API allows developers to create generalized tooling not tied to particular views or entities. Moreover, they need not worry about creating matching views for every collection of content. This ability to let API consumers craft their own result-set further reinforces the separation of concerns between the client and the server.

    Entity Query API does all this by taking advantage of the excellent QueryInterface provided by Drupal Core. The module simply translates your request URI and associated query string into an entity query on the backend, executes it, and returns the results as JSON. By using this, we also get the built in access control that Drupal entity queries provide.

    Entity Query API is still in alpha (as of April 2016), but it fully supports everything that you can do with an entity query in code, i.e., conditions, condition groups, sorting, ranges, etc. Like the REST UI module, we have a similar configuration page for enabling queryable entities. We support all core authentication methods as well as JSON Web Token Authentication (another module we’ve built). In future, we’d like to dynamically collect any authentication providers available, just like the REST UI module.

    I’m going to be sprinting on Entity Query API at DrupalCon New Orleans on Monday, May 9th 2016 and during the after-DrupalCon sprints on Friday, May 13th 2016. We’d like to add support for other encodings like XML and HAL+JSON (currently the module just supports JSON). Finally, we’d like to add the option to retrieve just entity IDs instead of fully loaded entities.

    As always, there’s plenty of work to be done in open source. If you’re interested in Entity Query API, come find me during the sprints or send me a tweet anytime during DrupalCon, my handle is @gabesullice. Of course, the easiest way to help is just to download the module and report any bugs you find. Finally, if you're going to be at DrupalCon New Orleans, stop by the Aten booth, I'd love to hear your ideas and feedback!

    Categorieën:

    Chapter Three: How to Host Drupal 8 on DigitalOcean

    Planet Drupal - vr, 2016/04/29 - 10:21pm
    How to Host Drupal 8 on DigitalOcean

    These are instructions on how to setup DigitalOcean droplet to host your personal website. DigitalOcean is a very affordable cloud hosting for developers (starting from $5 for a very simple droplet 512MB Memory / 1 CPU and 20GB disk).

    Minnur Yunusov April 29, 2016
    Categorieën: