Around the Drupalverse with Enzo García

Posted by Lullabot on July 28, 2016 at 8:00pm
Matt & Mike talk with Eduardo "Enzo" García about his 18 country tour around the the world! We talk about various far-flung Drupal communities, motivations, challenges, and more.

Drupal Cache Case Study: Boosting Performance

Posted by Axelerant Blog on July 28, 2016 at 6:00pm
Drupal Cache Case Study

This Drupal cache case study began on a pleasant January afternoon in beautiful Goa. The entire company flew in for our annual retreat, enjoying the scenic beauty of the sandy beaches and the cool breeze. Between the fun times, we were ducking into our remote workspace, poring over a cachegrind report sent over by our client.

This report was generated for ajax responses coming from a product page on an e-commerce website. We could clearly see that the page was extremely slow to render and that this was true for all ajax responses.

 A Case Study

The Cachegrind report as sent by the client – Drupal Cache: A Case Study

Free Open Source Staffing Guide hbspt.forms.create({ portalId: '557351', formId: '0e484b0e-3475-47ed-b8f5-49fa6b4cacab' });

Progressive Doping:

Digging deeper to figure out what was causing the performance bottleneck, we use XDebug to generate cachegrind files, which we could then analyze to determine what functions were costing us the most, or where there were functional paths that could be truncated via caching. Performing this process iteratively we came up with a list of major pain areas. This list was very specific to our project.

  1. Function “get nid from product_id” was being frequently called with a resulting resource consuming data query.
  2. Function “hook_commerce_checkout_pane_info_alter” was being executing on each request.
  3. Product filtering for a particular type of user was a resource consuming activity
  4. Function “get product_id matching attributes” was being frequently called, with a resulting resource consuming query.
  5. The theme function “theme_extra_bundles_radio” was processing some resource consuming business logic.
  6. A lot of calls were made to the “entity_load” function.
Drupal Cache

It is a widely accepted fact that as great as the Drupal 7 core can be, it doesn’t scale well for Web sites with a lot of content and a lot of users. To extract the best performance under such scenarios, it’s necessary to make use of several strategies, tools, and techniques. Keeping this in mind, we settled down with the following strategies:

  • Basic Drupal caching:

Drupal offers basic performance settings at:

Administration > Configuration > Performance > Development > Performance (admin/config/development/performance)

Here we enabled block and page caching which cached the dynamic complex SQL queries of Drupal for quick retrieval of content. We also enabled the Compress cached pages, Aggregate and compress CSS files and Aggregate JavaScript files which further helped in bandwidth optimization by reducing the number of HTTP calls.

  • Panel Caching:

    We developed a custom ctools plugin to provide two extra options for panel cache methods.

    • Complex cache
    • Lineup/Dealership cache
Lineup/Dealership cache - Drupal Cache: A Case Study

Lineup/Dealership cache – Drupal Cache: A Case Study

You can also define your panel cache method for your particular use case and cache the panel content.  First, define a ctool plugin like:

<?php // Plugin definition. $plugin = array( 'title' => t("Example cache"),
  'description' => t('Provides a custom option to cache the panel content.'),
  'cache get' => 'my_module_cache_get_cache',
  'cache set' => 'my_module_cache_set_cache',
);

/**
 * Get cached content.
 */
function my_module_cache_get_cache($conf, $display, $args, $contexts, $pane = NULL) {
   $cache = cache_get(‘my_panel_data', 'cache_panels');
  if (!$cache) {
	return FALSE;
  }

  if ((time() - $cache->created) > $conf['lifetime']) {
	return FALSE;
  }

  return $cache->data;
}

/**
 * Set cached content.
 */
function my_module_cache_set_cache($conf, $content, $display, $args, $contexts, $pane = NULL)    {

      	cache_set('my_panel_data', $content, 'cache_panels');
}

?>
  • Custom caching:

After looking at few more cachegrind reports, we identified some custom functions that were causing a performance problem and thrashing the database to perform complex queries and expensive calculations every time a user viewed specific pages. This prompted  us to use Drupal’s built-in caching API’s

The rule is never to do something time-consuming twice if we can hold onto the result and reuse them. This can be depicted in a simple example:

<?php function my_module_function() { $data = &drupal_static(__FUNCTION__); if (!isset($data)) { // Here goes the complex and expensive calculations and populate $data // with the output of the calculations. } return $data; } ?>

The drupal_static function provides a temporary storage to functions for data that sticks around even after they are done executing. drupal_static adds the magic to this function. It returns an empty value on the first call and preserves the data on next call in the same request. That means our function now can determine if the variable is already populated or not. If it has been populated, it will return the value and skip the expensive calculations.

The static variable technique stores data for only a single page load. To overcome this situation Drupal cache API persists the cached data in a database. The Following code snippet illustrates the use of Drupal cache API

<!--?php function my_module_function() 	{   
$data 	= 	&drupal_static(__FUNCTION__);   	
if (!isset($data)) {
  $cache = cache_get('my_module_data', 'cache_my_module')
  if ($cache && time() < $cache->expire) { 
    $data = $cache--->data;
  }
  else {
    // Here goes the complex and expensive calculations and populate
   // $data with the output of the calculations.
   cache_set('my_module_data', $data, 'cache_my_module', time() + 360);
  }
}
return $data;
}
?>

This version of the function uses database caching. Drupal caching API provides three key functions –  cache_get(), cache_set() and cache_clear_all(). The initial check is made to the static variable, and then this function checks Drupal’s cache for data stored with a particular key. If data is found the $data is set to $cache->data.

If no cached version is found, the function performs the actual work to generate the data and saves it to the static variable at the same time which means that in the next call in the same request, it does not even need cache_get.

Finally, we get a slick little function that saves time whenever it can—first checking for an in-memory copy of the data, then checking the cache, and finally calculating it from scratch.

Conclusion:

After putting all these together, we were able to reduce the total number of functions call to 741 and the execution time reduced to 665ms. Hence we get the ~1500% of performance boost.

 A Case Study

Cachegrind Report Generated After Implementing Drupal Cache. – Drupal Cache: A Case Study

Want to learn how to set up RESTful Drupal Caching? Check this out. jQuery(document).ready(function() { var cta_579a5eee2ab2b = false; jQuery(document).scroll(function() { if ( typeof ga !== 'undefined' && typeof isScrolledIntoViewPort !== 'undefined' && jQuery.isFunction( isScrolledIntoViewPort) && isScrolledIntoViewPort('.cta_579a5eee2ab2b') && cta_579a5eee2ab2b == false ) { cta_579a5eee2ab2b = true; ga('send', 'event', 'cta-wide', 'view-how-to-set-up-drupal-restful-caching', 'Check this out'); } }); });

References:

This article was originally published in April 2015.

This article Drupal Cache Case Study: Boosting Performance by Abhishek Dhariwal first appeared on Axelerant - Axelerant: Expert Drupal Development, Support, & Staffing.

Drupal Association's 12 Month Focus

Posted by Drupal Association News on July 28, 2016 at 5:10pm

At the end of May, I shared how The Drupal Association went through some hard staffing reductions so we could better align our expenses with revenue, making the organization much more sustainable. While this is a challenging transition, it allows The Association to serve our mission long into the future.

Part of this transition includes deciding where to focus our smaller team and, unfortunately, identifying work we can no longer take on. I want to give transparency into these decisions so we can best set expectations and invite the community to take over programs and work efforts we can no longer do. 

Our Focus

Our mission is to unite the community to build and promote Drupal. As I mention in my blog post, now that Drupal 8 is out, our focus is to put more energy into the “Promote Drupal” portion of the mission.

We will do this by improving the adoption journey within Drupal.org and DrupalCon. By adoption journey, I’m referring to the decision making path someone takes to chose a new content management platform for their organization. These decision makers narrow their choice by talking to industry peers and service providers, reading analyst reports, and gathering information online and at conferences. When decision makers visit Drupal.org or attend DrupalCon as part of their fact finding mission, we want to make it easier for them to see that Drupal is the right choice. We will curate content that highlights the power of Drupal solutions, amplifies success stories, and connects the decision makers with Drupal service providers and industry peers. 

It’s important that we play our role in growing the number of organizations using Drupal because gaining more Drupal customers is good for the project. They employ Drupal developers, contribute back code, and provide financial support. Plus, highlighting Drupal successes on Drupal.org and at DrupalCon creates a rallying point for our community. Let’s celebrate the many amazing ways organizations are using our community-built software. 

I do want to point out that the community will still have the great resources they need to continue building and releasing the software. We will still level up developer skills and host large sprints at DrupalCon. And, Drupal.org will continue to provide the tools and resources the community needs to release new versions.

What we can’t do right now is invest in new ways to improve the contribution journey. By contribution journey, I am referring to the path a person takes to join the community online and in person, to collaborate with others and contribute code, documentation, camp organization, etc. So right now, we are not spending resources to improve this contribution journey. However, we are studying what improvements are needed so we can invest in them again as we become financially stronger.

As we serve our mission, we will also focus on strengthening The Association’s sustainability. Naturally aligning expenses with resources is the biggest step in that direction. Now we will focus on strengthening our financial health by prioritizing revenue-generating initiatives as thoughtfully as we can. We’re starting this effort by finding out how to add value to each segment of our community so we can update our programs, making them even more attractive for people and companies to invest in.

There are many segments that make up our community from the individual to the business community of Drupal Shops, hosting companies, and technology companies. Each segment funds our mission work by buying Drupalcon tickets and sponsorships, by becoming Members and Supporting Partners, finding talent on Drupal Jobs, and buying Drupal.org digital opportunities. We will talk with members in each of these segments and see how we can make these programs better and more valuable to them.

Plus, our community has grown over the years and we need to welcome newcomers and find out how we can provide them with value that they are willing to pay for. Specifically, system integrators like Tata Consultancy Services and WIPRO and digital agencies like WPP and Digitas are now using Drupal to build ambitious digital experiences for their clients. By interviewing these organizations throughout the summer and fall, we will have a much better understanding of how to best support these kinds of organizations.

More Details

While the details I provided above are high level, The Drupal Association staff are operating from a 12 month execution plan that includes roadmaps with milestones and metrics. As we selected the work in our roadmap, we applied three imperatives:

  • Strengthen our financial health: Simply put, we will thoughtfully prioritize revenue generating opportunities that rebuild our cash reserves so we are more stable and do this in ways that add value to the community.
  • Execute well: We are picking a few areas to focus on so we are able to deliver results and make an impact. We are using good old fashion project management best practices to properly scope work and get stakeholder input to make sure we set ourselves up for success.
  • Determine strategic direction for future planning: While we are heads down working on our execution plan for the next year, we need to know where to focus next to best serve the community. The Drupal Association board and staff will spend time this year determining that strategic direction.

We want to share details of the work we will do this year, but rather than make this blog post even longer with all of that detail, we will do a blog series from the Events, Engineering, MarComm, Revenue, and Operations departments.

Each department will explain what their focus is in more detail and it will explain what work we are not able to do given our smaller size. Plus, we will highlight where community members can get involved to take on the work we can no longer do. If you are interested in volunteering your time to work on community programs, please contact me. We would love to work with you!

About Megan

As the Executive Director of The Drupal Association, I am inspired by the community values of kindness, collaboration, learning, and doing our best. The Drupal community is a bright spot in a complex world and I am personally motivated to protect its health and longevity.

Outside of work, you can find me exploring nature with my family and friends or working out with my bootcamp squad doing 100 burpees in the 100℉ / 38℃ heat of Tucson, Arizona, USA.

How to Print Variables using Kint in Drupal 8

Posted by Web Wash on July 28, 2016 at 11:10am

While developing a module or modifying a template in Drupal you'll often print variables, especially if you're in a preprocess hook.

You learn early on how to use var_dump and print_r function. But these functions can sometimes display too much information and can be hard to filter through the arrays or methods in the variable.

In Drupal 7, with the Devel module, you could use the dpm or dsm function. When used, these functions will print variables at the top of the page or in the message area using Krumo.

Now in Drupal 8, Devel has adopted a new library to print variables and it's called Kint.

World-wide and World-class Drupal Training

Posted by DrupalEasy on July 28, 2016 at 10:52am

DrupalEasy training globe image DrupalEasy is proud to announce another cavalcade of training events in the coming months, both online and in-person. We have numerous opportunities for you to take advantage of our proven Drupal 8 module and theme development courses as well as our flagship technical education program for those seeking comprehensive training to become developers; the 12-week Drupal Career Online.

The primary instructor for all courses is Mike Anello (ultimike), an expert instructor and experienced, practicing Drupal developer. All DrupalEasy training is taught by only expert developers to ensure that lessons are taught accurately, reflect best practices, and draw on how real-world Drupal sites are built. Mike has been active in the Drupal community for over 10 years, is a core contributor, a Drupal Association member, and one of the leaders of the Florida Drupal Users' Group.

12-Weeks of Career Training
Drupal Career Online starts on September 26, and runs every Monday and Wednesday afternoon from 1-4:30pm EDT. In addition, there is a 4-hour co-working lab, which is scheduled by the students. Class is held online using GoToMeeting, and use of webcams and microphones keeps the classes highly interactive, with instructor and student-led demos and discussions. The live online classes are supplemented with reference and lesson-guide handouts, as well as screencasts that cover each and every lesson. Each student is assisted by a community mentor to help kickstart their personal Drupal network. Our goal is to provide the most holistic, sanely-paced, best-practice-focused, long-form Drupal course in the world.

Interested in learning more about 12-week Drupal Career Online course? We are offering two free Taste of Drupal webinars that outline the entire course, set expectations, and give potential students the opportunity to ask questions. Past students have included Drupal newbies, hobbyists, and content admins looking to learn how to become full-fledged Drupal developers.

5 Options for D8 Theme and Module Development

First, if you're headed to DrupalCon Dublin, we're excited to announce that we've been selected to be one of the official training providers! We'll be offering our Introduction to Drupal 8 Module Development workshop live, and in-person. You'll learn through our stellar curriculum, and have follow-on access to all of the handouts and screencasts, with the added bonus of the synergy (yes, we just used that word) of a live classroom.

We're also offering the popular Introduction to D8 Module Development online, as well as our Introduction to D8 Theme Development workshops (https://www.drupaleasy.com/training/workshops/upcoming) multiple times in August and September. The module development workshop is 8 hours, split over two half-days, and teaches the fundamental concepts of Drupal 8 module development, including using Drupal Console as an aid for module development. Our theme development workshop is 12 hours long, split over three half-days. This super-sized workshop teaches the fundamental concepts of Drupal 8 theme development including building template files with Twig, creating custom subthemes (using Bootstrap as the base theme), and setting up a professional-level front-end development toolchain using Node.js and Gulp. Both of these courses include a live instructor, PDF handouts, and screencasts for all in-class examples.

We are committed to providing the highest quality Drupal talent development, from beginner to advanced programs; which is why our trainings work. We've taught the 12-week DCO ten times (including twice as part of Acquia U) and our 1 and 1.5 day workshops always get great reviews, just see what our graduates have to say!

Efficient Drupal / PHP development on Windows using cygwin and Cmder

Posted by hussainweb.me on July 28, 2016 at 3:50am
In this post, let's cover how you can set up your Windows machine for optimal Drupal development (or PHP in general). I'll be covering Windows 10 but this could very well apply for other versions.

The central data hub of VDMA - The VDMA E-Market

Posted by Cocomore on July 27, 2016 at 10:00pm

Products of different manufacturers can be found in the E-Market of the Association for German Machinery and Plant Engineering (VDMA). We are introducing the E-Market’s special features in the sixth part of our blog series “The Central Data Hub of VDMA”. 

Pathauto added special characters in url alias - drupal 7

Posted by Phponwebsites on July 27, 2016 at 7:54pm
    To improve SEO, we need to clean our URLs. By default in drupal, we've an option called clean URLs at the configuration. In drupal 7, we can also manage the URLs. For instance, you have a content type called services. You wanted to each service page have url like services/page-name. To do that, we've a pathauto module in drupal 7. The pathauto module allow us to manage the URLs for every content types, files, taxonomy & users and also we can remove some unnecessary words from URL like an, the and so on.

   The pathauto module can remove some unnecessary words like a, an, the and so on & also remove special characters like !, @, $ and so on. Unfortunately, it doesn't included some other symbols like copyright(©), trademark(™), registered(®) and so on. But it provide a hook to add new symbols into the punctuation settings called hook_pathauto_punctuation_chars_alter. After created a content with some symbols which are represented above, your page URL looks like below image:


Drupal 7 - remove special characters from url using pathauto module


/**
 * Implements hook_pathauto_punctuation_chars_alter().
 */
function phponwebsites_pathauto_punctuation_chars_alter(array &$punctuation) {
  $punctuation['copyright']          = array('value' => '©', 'name' => t('Copyright'));
  $punctuation['registered']         = array('value' => '®', 'name' => t('Registered trademark'));
  $punctuation['trademark']          = array('value' => '™', 'name' => t('Trademark'));
}
   After implemented above code into your module, you cold see added symbols are listing on Pathauto module's settings page at /admin/config/search/path/settings. If You didn't get these symbols, clear cache & test it again. It looks like below image:


Drupal 7 - pathauto settings after hook_pathauto_punctuation_chars_alter

Now you can create a content with those symbols. The pathauto module didn't added those symbols into the URL.

Now I hope you know how to remove some special characters from URL alias using pathauto module in drupal 7.

GSOC 2016- Developing tests for “Fil Alt Text” feature of Google Vision module- Week 9

Posted by Arpit Jalan on July 27, 2016 at 5:01pm
TL;DR Last week, I had worked on and developed tests to ensure that the similar images are grouped in accordance to the Image Properties feature of the Vision API. The code is under review by the mentors, and I would continue on it once the review is done. Meanwhile, they also reviewed the “Fill Alt Text” feature issue, and approved it is good to go. This week, I have worked on developing tests for this issue.

An important feature that I have implemented in the Google Vision API module is the filling of Alt Text field of an image file entity by any of the four choices- Label Detection, Landmark Detection, Logo Detection and Optical Character Detection. My mentor suggested me to check the availability of the response and then fill the field, as we can not fully rely on the third party responses. With this minor suggestion being implemented, now its time to develop tests to ensure the functionality of this feature.

I started developing simple web tests for this feature, to ensure that the Alt Text field is properly filled in accordance to the choice of the user. It requires the selection of the four choices one by one and verify that the field is filled correctly. Thus we require four tests to test the entire functionality. I have added an extra test to ensure that if none of the options are selected then the field remains empty.

I created the image files using the images available in the simpletests. The images can be accessed through drupalGetTestFiles(). The filling, however, requires call to the Google Cloud Vision API, thus inducing dependency on the API key. To remove the dependency, I mocked the function in the test module, returning the custom data to implement the feature.

The first test ensures that the Label Detection feature returns correct response and the Alt Text field is filled correctly. The simpletest provides a list of assertions to verify it, however, I found assertFieldByName() to be most suitable for the purpose. It asserts the value of a field based on the field name. The second test ensures that the Landmark Detection feature works correctly. Similarly, the third and fourth test ensures the correct functionality of the Logo and the Optical Character Detection feature.

The fifth test which I have included perform tests when none of the options are selected. It ensures that under this case, the Alt Text field remains empty, and does not contain any unwanted values.
I have posted the patch covering the suggestions and tests on the issue queue Fill the Alt Text of the Image File using Google Vision API to be reviewed by my mentors. Once they review it, I would work on it further, if required.

DrupalCamp Bristol 2016 - Chairman's Write-up

Posted by Microserve on July 27, 2016 at 4:13pm
DrupalCamp Bristol 2016 - Chairman's Write-upJul 27th 2016

DrupalCamp Bristol 2016 was held over this last weekend, and I hope I'm not the only one to say it was an enjoyable and very useful weekend for many. Although there were a couple of usual hiccups, feedback from attendees was very positive and certainly made it all feel worthwhile. Let's hope that wasn't just the beer talking!

Last year I wrote up some tips and feedback after the event, and as the Chair of the DCB Committee I thought it would be great to share my thoughts again this year. After all, Drupal as a community is based upon being open, so behind the scenes camp organisation should be too!

What went well?

Let's start of with the positives:

  • Business Day - In general the Business Day was a fantastic success. We had an increased number of attendees this year which included a larger number of client types, the talks were well varied and lived up to the high expectations set last year, and our new venue - Colston Hall - was a fantastic choice. The weather was brilliant and attendees were able to chat with each other outside on the roof terrace which was a great feature.
  • Quality of Saturday talks - I'll give a bit more insight into the talks shortly, but this year we managed to put together a larger number of talks without sacrificing any quality. Last year almost all of the talks were of a technical nature, but this year we managed to get a better variety which is the first step to brining in newer faces.
  • Sponsors - This year we completely changed the Sponsor tiers up, allowing us to reduce the number of agency types involved. We had 4 key Organisational Sponsors, a Recruitment Sponsor, and a couple of "Brunel tier" Sponsors, which was well received. I think I'm correct in saying that most of the Org Sponsors have an existing relationship with the Recruitment Sponsor, so we were able to pick somebody we trusted for the exclusive Sponsor role.
  • Quiz - This year we ended the Saturday talks at 3.30pm and finished with a Quiz instead for a lighter end to the day. Admittedly the questions were a bit hard and in some cases....different, but the teams soon began to laugh at it and with a load of prizes to give away it was a win-win situation for everybody!
  • Social - We invested heavily in bar tabs both Friday and Saturday, with a total of £1K budgeted between both evenings, and this was definitely worthwhile. For the Business Day attendees the socials are where the networking is most prominent, and for developers the socials are where most people really seem to bond. Personally I think the relationships which are forged at the socials are key to ensuring the regular faces return each year, as this is where you get a real sense of community and team spirit.
  • Sprints - We held a day of Sprints for the first time and we had to stop ticket sales as this had reached maximum capacity. Thanks to Torchbox for letting us use their offices for this one.
  • Use of Slack - The committee was much more dispersed this year, but using Slack as a communication tool made things much simpler and ensured the remote factor didn't play against us.
What didn't go so well?

There were a few things that concerned me, and although some where event specific I think there's some wider problems that are becoming apparent in the Drupal Community. I'd be really keen to hear how we as a community can go about improving these:

  • New talent is lacking - It was great to hear during Sheena Morris's Apprenticeships talk that agencies in the North and in London have adopted their Apprenticeship program so well, but Saturday's attendees showed that there is a huge lack of new Drupal talent. Emma Jane won "Learning Drupal 8" during the Quiz which was kindly provide by Inviqa, and gifted it to the person in the room who was newest to Drupal. The person in the room with the least Drupal experience had just less than 2 years!
  • Female speakers are sparse - Speaker diversity is a problem which isn't new to us, and this year we only had one female speaker per day. What's troublesome about that is that we didn't have a single talk submission from a female to choose from; it was committee members who sourced both of those speakers.
  • Last minute program changes - I guess this one is unavoidable, but 3 speakers dropped out of Saturday within a week of the event, and upon arriving at the venue on Saturday morning we were told the main lecture theatre was out of use and we had to direct talks to another lecture theatre. Typical! It would be interesting to know how other camps deal with this; maybe we shouldn't include the Saturday schedule in the printed programme, but instead ensure attendees use the website as the primary source of this info?
Camp Funds, DCB 2017, and the Committee

We've estimated an income of £11K this year, with expenditure of just short of £10K. We started the year with a cushion of approximately £4K from last year's camp, which gives us around £5K to rollover. I personally think it would be great to invest some of this into the local Drupal community, perhaps sponsoring more regular talk nights and Sprints? I'd be interested to hear of any suggestions - tweets to @DrupalCampBris.

The committee will be having a wash up meeting over the next week to discuss next year and see what we can do to improve the event, but I can guarantee you DrupalCamp Bristol 2017 will certainly be happening. Organisation will begin again later this year, and as the committee is always in need of new members we'd be interested to know if anybody new would like to join the team? Again, simply tweet @DrupalCampBris if you'd like to get involved.

Finally, I'd like to take this chance to offer up the Committee Chair position as I've decided to take a step down to a more back seat next year. I've thoroughly enjoyed leading the team over the first 2 years, but I think it would be good to see somebody else step into the role next year.

A massive thank you to everybody who attended, thank you to all the Speakers who volunteered their time over the weekend, thank you to all the Sponsors who made the event possible, and a huge thank you to all the committee members for pulling everything together and making the event a success.

See you all next year!

Rick Donohoe's picture

Written by: Rick Donohoe, Account Manager

Microserve is a Drupal Agency based in Bristol, UK. We specialise in Drupal Development, Drupal Site Audits and Health Checks, and Drupal Support and Maintenance. Contact us for for further information.

GSoC ‘16 - Week #10: Mailhandler updates

Posted by Miloš Bovan on July 27, 2016 at 3:29pm
GSoC ‘16 - Week #10: Mailhandler updates

This blog post summarizes week #10 of the Google Summer of Code 2016 project - Mailhandler.

In the last blog post, I was writing about the comment and demo module improvements. This blog post will provide an overview of the work done in the past 7 days. Even though the plan was to work mostly on UI/UX issues we ended up in code refactoring.

During the last meeting with my mentors we identified 3 key Inmail issues to work on: Lack of standard result in collaboration of analyzers, Support switching the user context and Provide a hook_requirements fed by plugin instances. We agreed those issues will provide better overall value in the integration of Mailhandler and Inmail modules. It will allow Inmail to implement ideas from Mailhandler, make them generic in a way both modules can benefit from.

Lack of standard result in collaboration of analyzers was identified as the main blocker to achieve analyzer collaboration. After a long discussion and 7 patches, it was finally committed. As a result, Inmail will have a default analyzer result which can be extended sequentially by all enabled analyzers. As this was a big change in core Inmail module, there are several follow-ups created.

Another Inmail issue Support switching the user context was dependent on the default analyzer issue. It uses AccountSwitcher service which completely switches the user context to the given user/account. That is done after the handlers run. In case the account switching mechanism was activated, we make sure it is switched back after the handlers-processing. On a handler level, we can use \Drupal::currentUser() and be sure it represents the identified user sender or an anonymous user otherwise.

Last but not least, I have been working on Provide a hook_requirements fed by plugin instances. The goal of this issue is to create a way for each of the Inmail plugins (analyzers, deliverers, handlers) to provide information about its runtime requirements. They can be PHP extension requirements, valid credentials etc. This information is displayed on “Status report” page (admin/reports/status) or processed by contrib modules like Monitoring.

PGP Analyzer requirementsPGP Analyzer requirements

Inmail plugins can produce several issues with unmet requirements. As displayed in the picture above, PGP Analyzer needs gnupg PHP extension in order to work with signed messages. On the other side, an IMAP deliverer needs valid credentials to be functional.

Since the most of the Inmail issues mentioned above were committed, Mailhandler module will need adaption which is going to be my focus for this week. Also, I will analyze the code of the module and try to simplify it. Besides the mentioned, I will work on Inmail UI/UX issues which will be described in the next blog post.

 

 

 

Milos Wed, 07/27/2016 - 17:29 Tags Drupal Open source Google Summer of Code Drupal Planet Add new comment

[GSoC 2016: Social API] Week 9: Social Post implementer - Part II

Posted by GVSO Blog on July 27, 2016 at 12:13pm
[GSoC 2016: Social API] Week 9: Social Post implementer - Part II

With this week over, we are getting closer to GSoC final evaluations. Therefore, we keep working hard to develop the Social API project even further. This week, I focused on Social Post Twitter as I mentioned in my last weekly summary. This module works as an implementer of Social Post.

gvso Wed, 07/27/2016 - 08:13 Tags Drupal Drupal Planet GSoC 2016

7 facts that reveal the state of Drupal

Posted by Deeson on July 27, 2016 at 11:34am
7 facts that reveal the true state of DrupalDrupalCon New Orleans

Drupal 8 was released on the 19th of November, 2015. Just a touch under five years from the 5th of January, 2011 release of Drupal 7. In web terms, an epoch. To put things in context, in 2011 AngularJS had not reached 1.0, React was two years out from being released and the term “Devops” was only whispered in dark corridors. Now that Drupal 8 is finally here the front-end revolution is led by AngularJS and React and articles are proclaiming that “DevOps is dead”. In short, much has changed.

Understandably, this has created some concern within the Drupal community. Has the huge Drupal 8 release cycle hurt Drupal in some irrevocable way? Is Drupal still a relevant technology? Is it too little too late or, as some argue, too much too late?

At the New Orleans DrupalCon, roughly six months after the release of Drupal 8, many were trying to glean some answers from available data. One fact cited is that after the first three months of the Drupal 8 release there were roughly 60,000 sites compared to 30,000 in the equivalent time period for Drupal 7. However, others argued that that is not necessarily a positive number because (as is pointed out here) the Drupal community is also three times bigger now.

In addition, the reasons that are holding people back from moving to D8 were discussed. Dries Buytaert’s keynote at the New Orleans DrupalCon covers that very well, with the leading factor being the migration of existing modules from Drupal 7 to Drupal 8.

However, as Dries goes on to explain, the number of sites and the number of upgraded modules are not the only relevant metrics. He argues that this increase in the richness and reach of Drupal will ultimately mean that Drupal 8 will see much bigger numbers than any other Drupal release.

What I will attempt to do in this blog post is add to the discussion by offering some simple facts that are very revealing about the actual state of Drupal and are relevant to any organisation trying to decide whether Drupal should form a component of their web strategy for the next five years.

Millions in ongoing investment by the Drupal community

2016 marks the year where it is no longer a novelty for leading Drupal agencies to employ people with a very specific mandate of working directly on Drupal core issues, or large Drupal 8 contrib modules (here at Deeson this is exactly what we do with the Group module, Rainmaker, Warden and our monthly Coder Lounge). The amount of ongoing direct investment from Drupal agencies and other organisations easily runs into multiple millions.

$500,000 invested to accelerate Drupal 8 module development

Acquia alone is investing $500,000 to speed-up the migration of popular Drupal 7 modules to Drupal 8. This means that popular modules will be ready faster and, more importantly, the quality of those modules will be higher as the maintainers will be able to dedicate focused time to get upgrades right. Using Drupal 8 means you are using an open-source CMS that is built to very high standards from some of the best developers around.

Big site wins are no longer big news

There was a time when a big site launching on Drupal would represent headline news in the community. It would receive applause at conferences and would be tweeted widely. This is no longer the case. Everyone is still happy to hear about big names joining Drupal but it is not news, it is the normal state of affairs.

These big launches span from media brands like ITV to multinationals like Johnson & Johnson; from pop singers to large cultural institutions. While the absolute number of sites running a CMS is important, the number of large complex sites using Drupal is arguably more significant to an organisation looking to set out its strategy for the next 5 years.

DrupalCon isn’t just about Drupal anymore

If you haven’t attended a DrupalCon yet, you should. One of the most interesting ways DrupalCons have evolved in the past few years is that they are no longer just about Drupal. There are dedicated tracks on project management, business development, user experience, PHP, front end technologies and much more. This is proof of a maturing community.

As the community has matured, interests have become more diverse and the breadth of shared practices has grown. Drupal has community sharing in its DNA which means that, by using Drupal, you are tapping into a very rich world that is willing to share knowledge about every aspect of a web strategy.

Drupal 8 is actually already at 8.1.7

The Drupal release cycle has changed drastically from 7 to 8. This is an often overlooked “feature” of Drupal 8. While with Drupal 7 we essentially had the sum of features at the start and new functionality could only really develop through contributed modules, Drupal 8 brings minor releases that can add completely new functionality.

To prove the point we are already at Drupal 8.1.7 with Drupal 8.1.0 seeing exciting new features such as the addition of the BigPipe technique to Drupal. This finally allows Drupal to adapt and adjust its course, and the days of worrying about Drupal becoming irrelevant as the rest of the web marches on are behind us.

There are 17 external JS Libraries and 27 external PHP Libraries in Drupal 8

Drupal 8 core contains at least 17 significant JavaScript libraries and 27 PHP libraries that are completely separate open-source projects. Drupal has well and truly built bridges to other technology islands and this also makes Drupal stronger, more relevant and more resilient to changes.

You can build a Drupal site with 0% Drupal on the frontend.

0 is a strange number to be touting as a success. But Drupal 8 now realistically allows you to build a front end that is 100% Drupal free. At Deeson we are currently building amazing front end experiences using React and taking advantage of Drupal’s powerful content model to store information and allow editors to quickly add and update information. The wider community is developing modules and best practices around this (for example, the great work happening around the Decoupled Blocks module).

Now, given the above is Drupal a relevant technology for a modern, forward-looking web strategy? All indications point to an unequivocal yes. Drupal 8 is more relevant than ever. It is the most advanced open-source CMS and it is built in a way that allows it to embrace and enhance a range of other technologies. The best news is that we are just at the start of what Drupal 8 will be able to do and, as best practices and experience accrues, the possibilities and the efficiency with which projects can be delivered will improve.

Want to know more about this topic? We're holding a webinar on the current state of Drupal and where it's headed. During the webinar you'll have the chance to ask Ronald Ashri, author of this post, any questions you like on this topic.

Interested? Sign up using the form at the top of this page.

 

GSoC’ 16: Port Search Configuration module; coding week #9

Posted by Into my Galaxy on July 27, 2016 at 10:12am

I am part of the Search Configuration module porting process to Drupal 8 as part of the Google Summer of Code’ 16. I have been mentored by Karthik Kumar, Naveen Valecha and Neetu Morwani. If you would like to have a quick look at my works so far, please go through these posts.

The past week I worked on fixing some of the issues in the port process. Moreover, I could learn some important concepts in the process. I ported the helper functions of the search configuration settings to the form API.

Basically, settings were stored as helper functions in the Drupal 7 module. I ported the helper functions of the search configuration settings to the form API. Generally, forms are created and worked on using four important functions, namely, getFormId, buildForm, validateForm and submitForm. These definitions are stored in classes.

The basic format will be of the form:


use Drupal\Core\Form\FormBase;
 
use Drupal\Core\Form\FormStateInterface;
 
class searchForm extends FormBase {

 public function getFormId() {
    return 'search_form';
  }

  public function buildForm(array $form, FormStateInterface $form_state) {
    //create the form here.
    return $form;
  }

  public function validateForm(array &$form, FormStateInterface $form_state) {
    // Validate submitted form data.
  }

  public function submitForm(array &$form, FormStateInterface $form_state) {
    // Handle submitted form data.
  }
}

The getFormId() returns the unique id of the form. We need to write the features of the form in the buildForm(). It includes the structure of the form, various fields included and its corresponding types accepted. The validate form is for validating the contents entered into the form which is definitely an important part of any form. Finally, the submitForm() handles the works to be carried out once the user enters the data in the form fields.  This mode of arrangement of the form functionality makes it more standard and properly arranged.

Also, the deprecated functions were removed from the .admin.inc of the module. There were some underscore functions in the Drupal 7 module which supported the configuration and the form settings. These are to be added to the helper file of the module.

These were some of the basic functionalities I could work on and explore. Stay tuned for the future updates on this port process.


CKEditor Anchor Link

Posted by Vardot on July 27, 2016 at 8:20am
Resources Read time: 3 minutes CKEditor Anchor Link for Drupal 8

We all are excited about Drupal 8 - there are many articles explaining why we shouldn’t be afraid to migrate to it. Briefly speaking, D8 is more mobile-friendly, multilingual, robust, and makes it easier to edit content by including several must-have modules to the core. However, since the new Drupal version was released not a long time ago, there are still many things left in the CMS that require from developers more effort when using Drupal 8. Some of the CKEditor plugins like CKEditor's AutoGrow will be integrated into D8 in the nearest future, but some plugins still have no integration or at least a plan of integration.

Working on the last project with our Drupal team at Vardot I’ve realized that there is a basic feature in D7’s CKEditor that is missing in D8, that is: Anchor Link. Basically this is the background of how the new module was created.

 

CKEditor Anchor Link

CKEditor Anchor Link allows content editors to insert links and anchors using multiple protocols. The possibility to link content was integrated to the core of Drupal 8, however as we can see from the screenshot it didn’t provide users the option to create flags within the document they are editing.

 

CKEditor Anchor Link in Drupal core

 

The ability to jump from one part of the page to another was critical for our client, and in Drupal 8 we had to go an extra mile and code it instead of just installing a module like in D7. CKEditor Anchor Link solves this problem and adds the new icon just in a few minutes. Moreover, it adds to the standard link icons their alternatives that provide site editors with more options of setting up the URL.

 

Upgraded CKEditor Anchor Link installed with a module

 

Installing CKEditor Anchor Link on Drupal 8

Below you can find a quick guide of how to install this module:

  1. Download CKEditor Anchor Link from drupal.org

  2. Enable the CKEditor Anchor module.

  3. Go to Configuration -> Text formats and editors.

  4. Select which text format you want to add the anchor button to. For example “Basic HTML”.

  5. Add the Link, Unlink, and Anchor, which came from CKEditor Anchor Link module.

    CKEditorAnchorLink.gif

 

  1. Manually remove default link and unlink command buttons and add the new link and unlink, which came with CKEditor Anchor Link.

  2. Save the settings for the for the  “Basic HTML” text format.

  3. Try to add new content, for example Basic page or Blog post, then in the body select the “Basic HTML” text format, then you should see the flag icon in the CKEditor tool.

 

Usage statistics for CKEditor Anchor Link 

The module is pretty new, and the number of users is not very big yet. The good thing however is that it's constantly growing and promises to reach a good level in the future (this blog post is to increase the visibility of CKEditor Anchor Link Module).

 

CKEditor Anchor Link usage statistics from drupal.org

 

Bottom line

For many editors the ability to quickly jump within the page they are editing (link, unlink, and flag it) is one of the top editing priorities. Since the goal of Vardot distributions Varbase and Uber Publisher is to make Drupal as more editor-friendly as possible, CKEditor Anchor Link seems to be an important addition to our products. If you find this module valuable, please feel free to install it, share this article with others and of course provide me your feedback about the module.

Tags:  drupal 8 Drupal Planet Modules Title:  CKEditor Anchor Link

Highlights of issues you can still help with for Drupal 8.2.0-beta1

Posted by Drupal core announcements on July 26, 2016 at 9:19pm

There is about a week left before Drupal 8.2 goes into beta! That means we will switch to figuring out any issues with changes in the new version instead of making new changes. For core development that means new features and API additions will move up to 8.3. I asked initiative leaders of both proposed and active initiatives for key things that could use help in the remaining time.

API-first initiative

Allowing user registrations via the REST API only needs some more tests for which examples can be found elsewhere in core. Also, although it may sound a bit scary, REST requests without X-CSRF-Token header: unhelpful response significantly hinders DX, should receive a 401 response is actually a nice approachable novice issue to get involved with.

Ongoing, check out the proposed initiative roadmap and attend the API-first meetings every third Monday of every month 5pm GMT at in Google Hangouts.

Media initiative

An amazing feature is in the works to Improve the UX of Quick Editing images and could use some frontend reviews. Help is also welcome to get HTML 5 video and audio playback functionality directly from file field formatters as well as to get camera capture functionality on image fields.

Larger media management goals in core are still to be defined. The team is meeting on that on July 27th. Follow @DrupalMedia on Twitter. Public meeting times are 2pm UTC every Wednesday on #drupal-media on IRC.

Migrate initiative

Help on any of the issues tagged Migrate critical are welcome, especially Refactoring EntityFile to use process plugins instead which blocks several other issues.

Ongoing, check out the list of issues categorized in migrate's master spreadsheet, and follow @MigrateDrupal on Twitter. Public meeting times are alternating 1pm GMT Thursday and 1am GMT Friday every other week on Google Hangouts.

Workflow initiative

Content moderation module is proposed for core based on the existing improvements achieved by the initiative to expand revision handling for content. Helping with unblocking that issue is very welcome.

Other top issues are Allow removing a module's content entities prior to module uninstallation, Add archived base field to revisionable entities, and Upgrade path between revisionable / non-revisionable entities.

Ongoing, check out the high-level roadmap at https://www.drupal.org/node/2721129, and follow @drupaldeploy on Twitter. Public meeting times to be defined.

For a complete list of meeting times and places (links to Google Hangouts where needed), see the Drupal 8 core calendar.

Drupal Composer template and Phing as Drupal developer tools

Posted by InternetDevels on July 26, 2016 at 1:05pm
Drupal Composer template and Phing as Drupal developer tools

A detailed blog post by our Drupal developer about using
Drupal Composer template and Phing. It is written from
the point of view of the latest Drupal version — Drupal 8.

Read more

How to Convince your Client Slideshows are Bad

Posted by Mediacurrent on July 26, 2016 at 12:53pm
why slideshows are bad design and 6 alternative options

In my previous blog post, I talked about six design alternatives to avoid slideshows. The response to that blog post was great - who knew there were so many kindred spirits who dislike slideshows? From the feedback I received, the number one question was why are slideshows so bad in the first place? Hopefully this companion blog post will give you that deeper understanding of some reasons not to use a slideshow and maybe help convince your next client that slideshows are a thing of the past.

Access Readme Files in Drupal 8

Posted by OSTraining on July 26, 2016 at 10:42am
Access Readme Files in Drupal 8

In this tutorial we will add a module that makes site maintainers' lives easier.

With Drupal 8 setups you are encouraged to use composer, DrupalConsole and Drush because this is a faster and more effective way of adding components to your site. However, you can't access the readme file directly to read information about the module.

We will show you how to use the README module to access readme files directly from the Drupal 8 admin area.

GSOC 2016- Developing tests for Image Properties feature of Google Vision module- Week 8

Posted by Arpit Jalan on July 26, 2016 at 9:59am
TL;DR In the past two weeks I had worked on using the Image Properties feature offered by the Google Cloud Vision API to group the image files together on the basis of the dominant color components filling them. In addition, I had also worked on detecting the image files and filling the Alternate Text field based on the results of Label/Landmark/Logo/Optical Character Detection, based on the demand of the end user. This week, I have worked on and developed tests to ensure that the similar images are grouped in accordance to the Image Properties feature of the Vision API.

At present, the Google Vision API module supports the Label Detection feature to be used as taxonomy terms, the Safe Search Detection feature to avoid displaying any explicit contents or violence and the User Emotion detection to detect the emotions of the users in their profile pictures and notify them about it.

I had worked on grouping the images on the basis of the dominant color component(Red, Green or Blue) which they are comprised of. I got the code reviewed by my mentors, and they approved it with minor suggestions on injecting the constructors wherever possible.Following their suggestions, I injected the Connection object instead of accessing the database via \Drupal::database().

After making changes as per the suggestions, I started developing simple web tests for this feature, to ensure that the similar images gets displayed under the SImilarContents tab. It requires the creation of new taxonomy vocabulary and adding an entity reference field to the image file entity. After the creation of the new Vocabulary and addition of the new field to the image file, I created the image files using the images available in the simpletests. The images can be accessed through drupalGetTestFiles(). The first test ensures that if the Vocabulary named ‘Dominant Color’ is selected, the similar images gets displayed under the file/{file_id}/similarcontent link.

The grouping, however, requires call to the Google Cloud Vision API, thus inducing dependency on the API key. To remove the dependency, I mocked the function in the test module, returning the custom data to implement the grouping.

To cover the negative aspect, i.e. the case when the Dominant Color option is not selected, I have developed another test which creates a demo vocabulary to simply store the labels, instead of the dominant color component. In this case, the file/{file_id}/similarcontent link displays the message “No items found”.
I have posted the patch covering the suggestions and tests on the issue queue to be reviewed by my mentors. Once they review it, I would work on it further, if required.

Pages

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