Planet Drupal

Subscribe to Planet Drupal feed
Drupal.org - aggregated feeds in category Planet Drupal
Updated: 57 min 54 sec ago

Deeson: 24 things about Drupal 8 every CTO should know

Thu, 23/06/2016 - 15:16

Last updated 2nd December 2015

John Ennew, Drupal 8 contributor and Deeson technical lead has collected together the questions we’ve been receiving from clients about Drupal 8 into one handy list.

John is a speaker at DrupalCon and maintains Drupal modules used on thousands of websites throughout the world. He holds a Masters in Computer Systems Engineering and is an IET Chartered Engineer, in addition to winning ‘Techie of the Year’ 2015.

Do you have a question that we haven’t answered? Drop us an email at hello@deeson.co.uk or ask in the comments.

Contents

Planning for Drupal 8

 1. Why did Drupal 8 take so long?  2. When should I start building on Drupal 8?  3. How long until common contributed modules are going to be available?  4. How much do Drupal 7 developers have to learn?  5. Will Drupal 8 make Drupal builds cheaper?  6. Will Drupal 8 sites be quicker to build?

Implications for Drupal 7

 7. Is there an upgrade path from previous Drupal versions?  8. How long will Drupal 7 support last now Drupal 8 is out?

New functionality in Drupal 8

 9. Does Drupal Commerce feature in the Drupal 8 release?  10. Are multi-lingual sites handled differently in Drupal 8?  11. How is the content editor experience different in Drupal 8?  12. Does Drupal 8 handle complex user and content permissions any differently?

The front-end and Drupal 8

 13. Does Drupal 8 change the approach to theming and front-end standards?  14. How is accessibility handled in Drupal 8?

Drupal 8 in the enterprise

 15. Does Drupal 8 make enterprise development practices such as automated testing easier?  16. Is it easier to manage a large portfolio of sites with Drupal 8?  17. Has configuration management improved in Drupal 8?

Architecture changes

 18. What does Drupal 8 mean for ‘headless Drupal’?  19. Does Drupal 8 change how Drupal integrates with other systems?  20. Is the database abstraction layer any different?  21. I’ve heard Symfony is used heavily in Drupal 8 core, what are the implications?

Performance and security

 22. Are there performance improvements in Drupal 8?  23. Has High Availability (HA) improved in Drupal 8?  24. Does Drupal 8 have any major differences in its approach to security?

 

Planning for Drupal 8 1. Why did Drupal 8 take so long?

Drupal has been around for 15 years and Drupal 8 has been in development for 5 years. This sounds like a long time to produce a release.

Under the hood, Drupal 8 has lots of big changes from Drupal 7. Many new programming concepts and paradigms have been adopted which will make Drupal more standards-compliant. This has meant removing old, more Drupal specific ways of doing things and embracing more widely known standards and technologies.

The discussion plan in Drupal community is that in future there will be gradual, phased releases allowing feature development to proceed in separate branches, rather than waiting for other functionality to produce a single large release like Drupal 8.

2. When should I start building on Drupal 8?

Drupal 8 should be considered for all projects from now onwards. The decision on whether it’s the right time for a specific project will depend on the appetite for risk, the nature of the functionality and complexity of the project.

There are many contributed modules that don’t have a stable release yet. This means a project may end up building a Drupal 8 version of a particular tool which would be available ‘for free’ in Drupal 7.

However, this is likely to be outweighed by the long term advantages of choosing Drupal 8. We’d recommend that a project scheduled to launch in 6 to 12 months time should select Drupal 8 over Drupal 7.

The fundamental overhaul of the multilingual system in Drupal 8 means that multilingual sites should always choose Drupal 8.

A project with a close, hard release date may not want to take on the risk of an unexpected bug in Drupal 8 impacting development or causing post-launch issues. These issues are always more likely in a new product before it’s had widespread production use.

3. How long until common contributed modules are going to be available?

Deeson maintains a list of 52 modules which are used in a large number of our projects. 11 are now included in Drupal 8 Core so will be fully supported, 9 have community contributed releases in an alpha or beta stage of development and the rest, 32 modules, have no testable release as yet.

For simple brochure sites with limited functionality, Drupal 8 is ready now as some of the most important content management tools are now included in the core platform.

However, there are some significant omissions, e.g. Pathauto and Tokens which are used to automatically generate tags in emails or automatic URL aliases based on the title of content.

Our experience of Drupal 7 was that contributed modules started being usable one year after the initial Drupal 7 release. We expect the turnaround to be quicker this time because Drupal 8 core incorporates many of these modules and that key contributed modules will be stable by May 2016.

4. How much do Drupal 7 developers have to learn?

Some major changes to Drupal 8 are the introduction of the Twig templating system for the theme layer, the introduction of components of the Symfony framework into core, the plugin system and a general principle to move to an object-orientated style of programming from the previous, procedural style. Drupal 7 developers, therefore, have quite a bit of learning to do.

It is expected that over the next year interest in Drupal 8 will grow and more developers will begin learning the skills needed to work on a Drupal 8 project. The Drupal community has done an excellent job of providing support material on the Drupal.org website with better documentation than previous versions of Drupal had.

Development teams will need to start ramping up their training now to support the projects they will be taking on in the next 6 months or risk being left unprepared.

5. Will Drupal 8 make Drupal builds cheaper?

As with previous versions, Drupal 8 will have no license fee so is free to reuse.

The cost of projects built using Drupal 8 is unlikely to be significantly different compared with projects built with previous versions of Drupal.

However, we believe that there will be long term reductions in the total cost of ownership because of the improvements made under the hood in Drupal 8. Development best practices have been introduced including a new plugin system making it easier to extend and enhance Drupal 8 compared with previous versions.

6. Will Drupal 8 sites be quicker to build?

There has been significant improvements in what is known as DX, or developer experience. These should improve the abilities of the development team to develop sites and diagnose issues.

Examples include moving to Object-Oriented OO coding principles which organises code more logically and in a manner the developer tools understand. This means that code can autocomplete in their editing tools. Another example is the Twig templating layer which better organises the theme system in Drupal, meaning that it is harder for developers to create untidy code.

Of course, many development teams have been applying these practices on top of Drupal 7 already so are already getting the benefits of these tools and practices which are now in Drupal 8 core.

Implications for Drupal 7 7. Is there an upgrade path from previous Drupal versions?

The Migrate module is included in Drupal 8. Migrate provides a series of tools a developer can use to map content in a Drupal 6 or 7 website to its location within a Drupal 8 website.  Although not a simple process, it does mean the migration path from previous versions of Drupal is available.

8. How long will Drupal 7 support last now Drupal 8 is out?

The Drupal community is committed to supporting the previous version of Drupal. This means Drupal 7 will be supported until Drupal 9 is released. There is currently no official release date for Drupal 9 and so no end of life date for Drupal 7.

I expect support for Drupal 7 for many years, particularly considering the huge install base of Drupal 7 sites.

New functionality in Drupal 8 9. Does Drupal Commerce feature in the Drupal 8 release?

Drupal Commerce is not maintained by the Drupal core team but maintained by a company - Commerce Guys. They have a Drupal 8 version of the module in active development.

The new Drupal 8 version is described as offering significant improvements over the old versions of Drupal Commerce, including better add to cart facilities, faster product creation and more intuitive product administration.

10. Are multilingual sites handled differently in Drupal 8?

Previous versions of Drupal had only partial support for multilingual websites. Multilingual projects usually involved stitching together a number of contributed modules to provide support for various elements of Drupal to be translated and each worked in a slightly different way. This inconsistency caused many projects budget and deadline pressures.

There has been a significant overhaul of multilingual capabilities in Drupal 8. Translations of all core elements are done in a sane and consistent manner in Drupal 8 core.

The installation system natively supports 94 languages. There are simple processes for installing new languages and language updates. The administration interface is entirely translatable. Assets, such as files or images, can now be assigned to a language or shared between languages.

11. How is the content editor experience different in Drupal 8?

Drupal 8 ships with the popular CKEditor WYSIWYG web editor. This means this tool is supported as standard and so will be maintained to continue to integrate well with it.

The new NavBar module in Drupal 8 core offers a clean administration tool for accessing all sections of the administration interface.

Drupal 8’s quick edit feature allows content editors the ability to do simple editing and changes in the page instead of loading a form specially for editing content.

On the horizon there are improvements to media handling in Drupal 8 as well which will give Drupal 8 a superior interface for managing assets such as files and images but this did not make it into core.

12. Does Drupal 8 handle complex user and content permissions any differently?

Under the hood the content access permission system has been rewritten in Drupal 8 but the behaviour for content administrators is much the same as before.  

It is expected that contributed modules will be providing the fine grained additional permission control they did in previous versions of Drupal. The popular choice in previous versions of Drupal for this was Organic Groups, which hadn’t been refactored to match more recent core versions. To provide stable functionality in Drupal 7 we have been using the Group module instead, we are planning to create a Drupal 8 release too.

The front-end and Drupal 8 13. Does Drupal 8 change theming and front-end standards approach?

In Drupal 7 PHP based templates made it too easy for developers to place logic in their templates which should have been managed in modules. Over time, templating code which was not strongly controlled would become fragile and it would be hard to find bugs and add new functionality.

Theming has changed significantly with the introduction of the Twig templating system in Drupal 8. Developers will now be able to write almost all markup in Twig templates rather than PHP code in functions. Though there will be an initial investment in learning required by development teams, the long term results will be cleaner templates which are more maintainable.

14. How is accessibility handled in Drupal 8?

There have been some improvements made to accessibility in Drupal 8.

WAI-ARIA landmarks, live regions, roles & properties are included which improves the accessibility of dynamic areas of the page. Drupal’s Form API now puts errors in-line rather than having the errors displayed in different regions to the form element which had the input error.

There is a JavaScript alert for audible announcements allowing site builders to include timely messages specifically for aural users. A new Tabbing Manager ensures a logical ordering to accessing page elements for users not using a mouse.

A general approach in Drupal 8 is to use standardised libraries to deliver functionality rather than trying to develop well known and well developed functionality from scratch. By working with library developers, best-of-breed technologies can be developed in partnership with a larger community.

One of the effects of this is that accessibility for a particular function can be developed by teams of people who really understand that field. A good example here is using the jQuery UI library to provide autocomplete functionality in Drupal 8. The Drupal community can now help the jQuery UI community in producing a better, more accessible tool.

Drupal 8 in the enterprise 15. Does Drupal 8 make enterprise development practices such as automated testing easier?

Several improvements in Drupal 8 make it a more effective platform for practising continuous development. The configuration management system means configuration now lives in code in a standard way meaning code can be safely transferred between environments and its behaviour is now predictable.

Drupal 8 code makes more use of objects and PHPUnit is supported by the testing infrastructure within the core codebase, meaning all code can now be written with unit tests.

Drush, the Drupal CLI tool, has been updated to work with Drupal 8 already, and can be used to automate most deployment activities from testing the quality of the custom code using the coder module, to testing the functionality using PHPUnit.

Automated testing has also been improved with Drupal 8. The core product now includes PHPUnit which is a test runner which allows both Unit and Functional tests.  These are better tests which run much quickly than previous versions.

PHPUnit is a well recognised tool in the wider PHP developer community, hopefully meaning that finding people to write tests and finding resources to help developers get to grips with testing will be easier with Drupal 8.

Drupal 8 is also supported by the popular Behat testing framework for Symfony allowing well formed behaviour driven development practices (BDD).

16. Is it easier to manage a large portfolio of sites with Drupal 8?

Drupal 8 is a good choice for organisations maintaing large portfolios of sites. Drupal is the most flexible and extensible CMS and so can be used to develop both small, simple websites but also larger, more complex ones. By choosing to consolidate on Drupal you can reduce the development effort required in maintaining a large estate.

Drupal 8’s RESTful APIs allows you to develop the sorts of enterprise tools needed to manage an estate of sites. Features like Drupal’s multi-site and the Group module mean that you can also take a single Drupal codebase and use it to deliver multiple websites. There will always be complexities with such approaches but Drupal is flexible enough to alter it to your specific requirements.

17. Has configuration management improved in Drupal 8?

Configuration management is the ability to define the configuration of a software application like a Drupal website in a testable, versionable way. In Drupal 7 it was often the case that configuration had to be done in each environment after a release rather than defining the behaviour of the website in each environment within the code of the website.

Drupal 7 had some addons that made this possible such as the Features module, but these were never done in an entirely satisfactory manner and each module had to define its exportable behaviour to Features.  

In addition, the variable table in Drupal 7 became a dumping ground of both configuration and state for each environment which meant that determining what needed to be exported into configuration in code and what could be safely ignored on a per-environment basis was complicated, time consuming and could lead to errors during deployment.

The Configuration Management Initiative in Drupal 8 has brought a standardised way for modules to define their editable configuration. Site builders can then export the configuration for an environment into configuration files which can be put into the website’s version control system and changed on a per-environment basis. This allows configuration to be audited, rolled back and be testable.

Architecture changes 18. What does Drupal 8 mean for ‘headless Drupal’?

Headless Drupal or Decoupled Drupal are terms used to describe the system’s architectural practice of separating the back-end and theming components of Drupal. In such an architecture, Drupal is used as a Content Management System for data entry and retrieval, but the rendering of web pages of content to end users (the theming layer) is passed over to another tool.

This allows development teams to build rich internet applications, mobile applications or apps for devices such as smart TVs, watches or the next Google Glass. Each of these devices have their own theming mechanisms and all of them just want pure data from the Content Management System.

Drupal 8 is capable of outputting data not just as HTML but in many forms such as JSON or XML. How it delivers data depends on the device or application which is requesting the data.

Choosing Drupal 8 as the Content Management system is a good investment for the future. Initially it may just be a website delivering to traditional web browsers, but later other apps or dynamic internet applications may be built which use the same Drupal back-end for retrieving their data.

19. Does Drupal 8 change how Drupal integrates with other systems?

Drupal 8’s inclusion of standard PHP libraries means that for any particular application it is likely that a good external library already exists. There is less of a reliance on a single developer working inside of the Drupal ecosystem to meet your integration needs.

Drupal 8 also provides mechanisms for exporting its data via a RESTful API allowing it to easily integrate with other systems.

In addition, the new plugin system within Drupal means that extensions to Drupal can easily be developed. This technology maintains Drupal’s position as the most extensible and flexible CMS framework available.

20. Is the database abstraction layer any different?

The process of standardising on the Drupal Entity model began in Drupal 7 and has been extended in Drupal 8. Developers working on developing websites with Drupal 8 will work at the Entity level rather than the database level. This allows Drupal 8 websites to work agnostically with a larger number of database technologies, not just the traditional relational ones such as MySQL. For example, it is possible to use NoSQL solutions such as MongoDB as the database storage layer with a Drupal 8 website.

In Drupal 8, the database API is pretty much the same as Drupal 7, but developers should almost never be making database calls directly unless they are developing core APIs.

21. I’ve heard Symfony is used heavily in Drupal 8 core, what are the implications?

In previous versions of Drupal all the code within Drupal was built by members of the Drupal community. In Drupal 8, the developers have embraced other projects like Symfony, and are building libraries which can be reused in other projects. Rather than re-inventing the wheel, Drupal 8 includes components developed by a larger community to solve a problem.

This means that Drupal benefits from a more stable codebase used in more projects. In return, projects like Symfony also get the benefit of more people making use of their code and so becomes more robust in the process.

Developers familiar with Symfony and not Drupal will now be able to move into Drupal development. This opens up the pool of talent development teams can draw on.

Symfony is written using industry standards and best practices, such as PSR-4 name spacing of classes, these have been incorporated in Drupal 8.

Performance and security 22. Are there performance improvements in Drupal 8?

The caching system was completely re-written in Drupal 8. In Drupal 7, often when a cache needed to be cleared the only option was to clear all caches meaning that a small change could cause a greater strain on the website as all the caches had to refill.  

Caching usually occurred at the page level as well in Drupal 7, which meant that either the whole page was returned from cache or the whole page needed to be regenerated. For logged in users, generally no caching happened and the whole page was generated for every page request.

In Drupal 8 the caches are much more complex and caching can be defined and cleared with greater precision. The new Cache Tags system allows, for example, pieces of a page to be cached so that logged in users might receive most of a page from cache and just the link to their account is generated.

Cache Tags also allows the developers to define specific cache-clear scenarios for their sites based on the known behaviour of the site - for example, it is possible to clear all caches which contain information about user 300 following an update to their account without clearing every other user’s cached data.

In addition, the cache system, like much of Drupal 8, is pluggable which means that better caching tools can be plugged in at all levels. For large, complex site, much more precise selections of tools can be used to improve performance.

The way the page build pipeline works has been overhauled in Drupal 8 meaning that a web page is built in a much more efficient manner to previous versions of Drupal. There is also a general ‘fast by default’ principal used by the Drupal 8 developers which makes sure that nothing needs to be enabled to provide performance boosts for Drupal 8.

23. Has High Availability (HA) improved in Drupal 8?

Drupal has been used in HA environments for many years now and is a well understood problem. Drupal 8 is similar to Drupal 7 in this respect. The improvements to the caching layer means that more complex strategies are now possible with Drupal 8 and additional thought may optionally be put into the configuration of caching tools.

24. Does Drupal 8 have any major differences in its approach to security?

The Twig templating system is a major change from the old way of allowing PHP code within the template code. Twig is full of features for ensuring a secure theming layer, which has historically been a common source of security vulnerabilities.

Another common vulnerability was introduced by site builders manually configuring text filters for a variety of third party WYSIWYG editors. Such an editor is a must for a content management system but installing them wasn’t supported natively by Drupal core and was one of the more complex tasks of a site builder. In Drupal 8, the CKEditor editor is included as standard with sensibly configured defaults which will work for most cases and be secure.

The PHP module has been removed from core which allowed site builders to write PHP code in the browser. This led to bad practices and also allowed a way for a malicious user who gained higher privileges in the website due to poor configuration to execute code on the server.

All input variables from the URL are properly declared by the new routing system. This means bad or unexpected data types get filtered by default. The previous CSRF protection provided by Drupal 7’s core APIs are also still available in Drupal 8.

A team of volunteers called the Drupal security team have managed looking for security issues in Drupal core and managing the security issue queue and advisory notices.

With so much third party code now required for Drupal 8 to work, managing security advisories to external libraries is more important. Modules making use of external libraries can alert to security problems with their dependencies via the hook_requirements event.

In Drupal core, external code actually forms part of the Drupal 8 codebase. When security problems are found in that code, the security team must then work with the third party developers to fix the problems and ensure security advisories affecting both code bases are released together.

Drupal 8 doesn’t provide an automated way of applying updates out of the box. However it’s possible for companies using Drupal websites to do this via a continuous integration process using the drush command line tool, version control and automated tests.

Categories: Elsewhere

Arpit Jalan: GSOC 2016- Providing Web Tests for the Safe Search feature for the Google Vision module- Week 4

Thu, 23/06/2016 - 14:34
TL;DR In my last post Avoid Explicit Contents in the images using Google Vision module, I had discussed about the services which “Safe Search” feature of the Vision API provides us, and how we have put this into use in the Google Vision module as a constraint to all the image fields which would be validated when the option is enabled. This week I have worked on developing simple web tests for testing this feature whether it gives us the results as expected.

Last week I had worked on developing the code to use the Safe Search detection feature as a constraint to the image fields which would validate the images for the presence of explicit contents, provided that the user enables the configuration for the concerned image field.

Besides the code, testing the functionality using simple web tests are equally essential to ensure that the feature executes perfectly when necessary steps are implemented.Hence, this week I have worked on developing simple web tests, which ensures that we have a fully functional feature.

I have tested both the conditions with safe search enabled and disabled to verify the results which should be obtained. When the safe search is enabled, any image containing any sort of  explicit content, is detected, and asked for moderation. If the image is not moderated, then the image is not saved. When the same image was passed through the second test, with safe search disabled, it was stored successfully, thus providing us the expected results.

To conduct the test successfully, I had to create a demo content type in my tests using drupalCreateContentType(), which would have an image field with the ‘Enable Safe Search’ option. This was something new to me to how to add an extra field to the default content type settings. The Drupal documentation on FieldConfig and FieldStorageConfig were of great help to understand the underlying concepts and functions which the field offers, and thus helping me to create custom fields programmatically. However, in order to perform the test, I had to call the API directly, which required a valid API key and an image which actually contains explicit content. Hence, my mentors asked me to override the functions of the class (mocking the services) in such a way that it removes the dependency from both the key and the image. Thus, I created a test module inside the Google Vision module, and override the function.

Summarizing the above, I can say that in addition to learning how to test the constraints and validators, I also came to learn about some really cool techniques, including the creation of custom fields in tests and mocking the services.
The lingotek_test of the Lingotek Translation module is a good reference to learn about how to override the services in web tests. Other references which are useful for mocking are ServiceProviderBase and Mocking for Unit Tests.
Categories: Elsewhere

Drupal.org Featured Case Studies: Open Social, Drupal 8 Distribution

Thu, 23/06/2016 - 12:45
Completed Drupal site or project URL: https://www.drupal.org/project/social

Open Social is a new Drupal 8 distribution. It's social software for communities and social intranets, similar to the Drupal 7 distribution Commons. Open Social empowers people to effectively collaborate and organize.

Open Social has many features, such as Profiles, Groups, Events, Streams, and Notifications, and is inspired by the Drupal 7-based online community Greenpeace Greenwire, built by GoalGorilla. The Greenwire platform has helped Greenpeace change the face of volunteering and empower thousands of people to become active volunteers and make a difference in the world.

Key modules/theme/distribution used: AddressBetter FormatsComposer ManagerConfiguration Update ManagerDynamic Entity ReferenceEntity APIField GroupGroupMessageOverride node options (d8)ProfileRedirect 403 to User LoginSearch APITokenBootstrapOrganizations involved: GoalGorillaOpen SocialTeam members: jaapjanjochemvnmaikel-koopmannielsvandermolenpeterpolmanribelronaldtebrake
Categories: Elsewhere

Deeson: 24 things about Drupal 8 every CTO should know

Thu, 23/06/2016 - 11:06

Are you preparing to migrate to Drupal 8? If so, you’re probably experiencing an influx of questions about what this means for your business. With so much time lapsed between the releases of Drupal 7 and 8, it’s hard to know what this new era will bring. But fear not; Deeson’s technical lead John Ennew has been busy collating all the queries we’ve received so far and writing some useful, insightful answers for you. This is the first of our three-part series answering all your burning Drupal 8 questions.

This week, we’re focusing on two areas: planning for Drupal 8, and the implications for Drupal 7.

 

Planning for Drupal 8 1. Why did Drupal 8 take so long?

Drupal has been around for 15 years and Drupal 8 has been in development for 5 years. This sounds like a long time to produce a release.

Under the hood, Drupal 8 has lots of big changes from Drupal 7. Many new programming concepts and paradigms have been adopted which will make Drupal more standards-compliant. This has meant removing old, more Drupal specific ways of doing things and embracing more widely known standards and technologies.

The discussion plan in Drupal community is that in future there will be gradual, phased releases allowing feature development to proceed in separate branches, rather than waiting for other functionality to produce a single large release like Drupal 8.

2. When should I start building on Drupal 8?

Drupal 8 should be considered for all projects from now onwards. The decision on whether it’s the right time for a specific project will depend on the appetite for risk, the nature of the functionality and complexity of the project.

There are many contributed modules that don’t have a stable release yet. This means a project may end up building a Drupal 8 version of a particular tool which would be available ‘for free’ in Drupal 7.

However, this is likely to be outweighed by the long term advantages of choosing Drupal 8. We’d recommend that a project scheduled to launch in 6 to 12 months time should select Drupal 8 over Drupal 7.

The fundamental overhaul of the multilingual system in Drupal 8 means that multilingual sites should always choose Drupal 8.

A project with a close, hard release date may not want to take on the risk of an unexpected bug in Drupal 8 impacting development or causing post-launch issues. These issues are always more likely in a new product before it’s had widespread production use.

3. How long until common contributed modules are going to be available?

Deeson maintains a list of 52 modules which are used in a large number of our projects. 11 are now included in Drupal 8 Core so will be fully supported, 9 have community contributed releases in an alpha or beta stage of development and the rest, 32 modules, have no testable release as yet.

For simple brochure sites with limited functionality, Drupal 8 is ready now as some of the most important content management tools are now included in the core platform.

However, there are some significant omissions, e.g. Pathauto and Tokens which are used to automatically generate tags in emails or automatic URL aliases based on the title of content.

Our experience of Drupal 7 was that contributed modules started being usable one year after the initial Drupal 7 release. We expect the turnaround to be quicker this time because Drupal 8 core incorporates many of these modules and that key contributed modules will be stable by May 2016.

4. How much do Drupal 7 developers have to learn?

Some major changes to Drupal 8 are the introduction of the Twig templating system for the theme layer, the introduction of components of the Symfony framework into core, the plugin system and a general principle to move to an object-orientated style of programming from the previous, procedural style. Drupal 7 developers, therefore, have quite a bit of learning to do.

It is expected that over the next year interest in Drupal 8 will grow and more developers will begin learning the skills needed to work on a Drupal 8 project. The Drupal community has done an excellent job of providing support material on the Drupal.org website with better documentation than previous versions of Drupal had.

Development teams will need to start ramping up their training now to support the projects they will be taking on in the next 6 months or risk being left unprepared.

5. Will Drupal 8 make Drupal builds cheaper?

As with previous versions, Drupal 8 will have no license fee so is free to reuse.

The cost of projects built using Drupal 8 is unlikely to be significantly different compared with projects built with previous versions of Drupal.

However, we believe that there will be long term reductions in the total cost of ownership because of the improvements made under the hood in Drupal 8. Development best practices have been introduced including a new plugin system making it easier to extend and enhance Drupal 8 compared with previous versions.

6. Will Drupal 8 sites be quicker to build?

There has been significant improvements in what is known as DX, or developer experience. These should improve the abilities of the development team to develop sites and diagnose issues.

Examples include moving to Object-Oriented OO coding principles which organises code more logically and in a manner the developer tools understand. This means that code can autocomplete in their editing tools. Another example is the Twig templating layer which better organises the theme system in Drupal, meaning that it is harder for developers to create untidy code.

Of course, many development teams have been applying these practices on top of Drupal 7 already so are already getting the benefits of these tools and practices which are now in Drupal 8 core.

Implications for Drupal 7 7. Is there an upgrade path from previous Drupal versions?

The Migrate module is included in Drupal 8. Migrate provides a series of tools a developer can use to map content in a Drupal 6 or 7 website to its location within a Drupal 8 website.  Although not a simple process, it does mean the migration path from previous versions of Drupal is available.

8. How long will Drupal 7 support last now Drupal 8 is out?

The Drupal community is committed to supporting the previous version of Drupal. This means Drupal 7 will be supported until Drupal 9 is released. There is currently no official release date for Drupal 9 and so no end of life date for Drupal 7.

I expect support for Drupal 7 for many years, particularly considering the huge install base of Drupal 7 sites.

That concludes our Drupal session for this week. Next time around, we’ll be covering the all-important new functionality in Drupal 8, as well as some crucial front end issues.

If you’d like to receive the next part of our our mini series on Drupal 8 right now, simply subscribe to our newsletter below. We’ll send the next part over to you straight away.

Categories: Elsewhere

myDropWizard.com: Drupal 6 security update for Secure Password Hashes!

Wed, 22/06/2016 - 20:42

As you may know, Drupal 6 has reached End-of-Life (EOL) which means the Drupal Security Team is no longer doing Security Advisories or working on security patches for Drupal 6 core or contrib modules - but the Drupal 6 LTS vendors are and we're one of them!

Today, there is a security release for Secure Password Hashes to fix a security bug.

By default in Drupal 6, all of a user's existing login sessions will be closed and the current session regenerated when a user changes their password. There was a bug in the Secure Password Hashes module that prevented this from happening.

With the help of the D6LTS vendors, a new version was released.

You can also download the patch the patch.

If you have a Drupal 6 site using the Views module, we recommend you update immediately! We have already deployed the patch for all of our Drupal 6 Long-Term Support clients. :-)

If you'd like all your Drupal 6 modules to receive security updates and have the fixes deployed the same day they're released, please check out our D6LTS plans.

Note: if you use the myDropWizard module (totally free!), you'll be alerted to these and any future security updates, and will be able to use drush to install them (even though they won't necessarily have a release on Drupal.org).

Categories: Elsewhere

Lullabot: Using the Template Method pattern in Drupal 8

Wed, 22/06/2016 - 18:01

Software design patterns are a very good way to standardize on known implementation strategies. By following design patterns you create expectations and get comfortable with the best practices. Even if you read about a design pattern and realize you have been using it for a long time, learning the formal definition will help you avoid eventual edge cases. Additionally, labeling the pattern will enhance communication, making it clearer and more effective. If you told someone about a foldable computer that you can carry around that contains an integrated trackpad, etc, you could have been more efficient by calling that a laptop.

I have already talked about design patterns in general and the decorator pattern in particular, and today I will tell you about the Template Method pattern. These templates have nothing to do with Drupal’s templates in the theme system.

Imagine that we are implementing a social media platform, and we want to support posting messages to different networks. The algorithm has several common parts for posting, but the authentication and sending of actual data are specific to each social network. This is a very good candidate for the template pattern, so we decide to create an abstract base class, Network, and several specialized subclasses, Facebook, Twitter, …

In the Template Method pattern, the abstract class contains the logic for the algorithm. In this case we have several steps that are easily identifiable:

  1. Authentication. Before we can do any operation in the social network we need to identify the user making the post.
  2. Sending the data. After we have a successful authentication with the social network, we need to be able to send the array of values that the social network will turn into a post.
  3. Storing the proof of reception. When the social network responds to the publication request, we store the results in an entity.

The first two steps of the algorithm are very specific to each network. Facebook and Instagram may have a different authentication scheme. At the same time, Twitter and Google+ will probably have different requirements when sending data. Luckily, storing the proof of reception is going to be generic to all networks. In summary, we will have two abstract methods that will authenticate the request and send the data plus a method that will store the result of the request in an entity. More importantly, we will have the posting method that will do all the orchestration and call all these other methods.

One possible implementation of this (simplified for the sake of the example) could be:

<?php namespace Drupal\template; use Drupal\Component\Serialization\Json; /** * Class Network. * * @package Drupal\template */ abstract class Network implements NetworkInterface { /** * The entity type manager. * * @var \Drupal\Core\Entity\EntityTypeManagerInterface. */ protected $entityTypeManager; /** * Publish the data to whatever network. * * @param PostInterface $post * A made up post object. * * @return bool * TRUE if the post was posted correctly. */ public function post(PostInterface $post) { // Authenticate before posting. Every network uses a different // authentication method. $this->authenticate(); // Send the post data and keep the receipt. $receipt = $this->sendData($post->getData()); // Save the receipt in the database. $saved = $this->storeReceipt($receipt); return $saved == SAVED_NEW || $saved == SAVED_UPDATED; } /** * Authenticates on the request before sending the post. * * @throws NetworkException * If the request cannot be authenticated. */ abstract protected function authenticate(); /** * Send the data to the social network. * * @param array $values * The values for the publication in the network. * * @return array * A receipt indicating the status of the publication in the social network. */ abstract protected function sendData(array $values); /** * Store the receipt data from the publication call. * * @return int * Either SAVED_NEW or SAVED_UPDATED (core constants), depending on the operation performed. * * @throws NetworkException * If the data was not accepted. */ protected function storeReceipt($receipt) { if ($receipt['status'] > 399) { // There was an error sending the data. throw new NetworkException(sprintf( '%s could not process the data. Receipt: %s', get_called_class(), Json::encode($receipt) )); } return $this->entityTypeManager->getStorage('network_receipts') ->create($receipt) ->save(); } }

The post public method shows how you can structure your posting algorithm in a very readable way, while keeping the extensibility needed to accommodate the differences between different classes. The specialized class will implement the steps (abstract methods) that make it different.

<?php namespace Drupal\template; /** * Class Facebook. * * @package Drupal\template */ class Facebook extends Network { /** * {@inheritdoc} */ protected function authenticate() { // Do the actual work to do the authentication. } /** * {@inheritdoc} */ protected function sendData(array $values) { // Do the actual work to send the data. } }

After implementing the abstract methods, you are done. You have successfully implemented the template method pattern! Now you are ready to start posting to all the social networks.

// Build the message. $message = 'I like the new article about design patterns in the Lullabot blog!'; $post = new Post($message); // Instantiate the network objects and publish. $network = new \Drupal\template\Facebook(); $network->post($post); $network = new \Drupal\template\Twitter(); $network->post($post);

As you can see, this is a behavioral pattern very useful to deal with specialization in a subclass for a generic algorithm.

To summarize, this pattern involves a parent class, the abstract class, and a subclass, called the specialized class. The abstract class implements an algorithm by calling both abstract and non-abstract methods.

  • The non-abstract methods are implemented in the abstract class, and the abstract methods are the specialized steps that are subsequently handled by the subclasses. The main reason why they are declared abstract in the parent class is because the subclass handles the specialization, and the generic parent class knows nothing about how. Another reason is because PHP won’t let you instantiate an abstract class (the parent) or a class with abstract methods (the specialized classes before implementing the methods), thus forcing you to provide an implementation for the missing steps in the algorithm.
  • The design pattern doesn’t define the visibility of these methods, you can declare them public or protected. If you declare these methods public, then you can surface them in an interface to make the base class abstract.

In one typical variation of the template pattern, one or more of the abstract methods are not declared abstract. Instead they are implemented in the base class to provide a sensible default. This is done when there is a shared implementation among several of the specialized classes. This is called a hook method (note that this has nothing to do with Drupal's hooks).

Coming back to our example, we know that most of the Networks use OAuth 2 as their authentication method. Therefore we can turn our abstract authenticate method into an OAuth 2 implementation. All of the classes that use OAuth 2 will not need to worry about authentication since that will be the default. The authenticate method will only be implemented in the specialized subclasses that differ from the common case. When we provide a default implementation for one of the (previously) abstract methods, we call that a hook method.

At this point you may be thinking that this is just OOP or basic subclassing. This is because the template pattern is very common. Quoting Wikipedia's words:

The Template Method pattern occurs frequently, at least in its simplest case, where a method calls only one abstract method, with object oriented languages. If a software writer uses a polymorphic method at all, this design pattern may be a rather natural consequence. This is because a method calling an abstract or polymorphic function is simply the reason for being of the abstract or polymorphic method.

You will find yourself in many situations when writing Drupal 8 applications and modules where the Template Method pattern will be useful. The classic example would be annotated plugins, where you have a base class, and every plugin contains the bit of logic that is specific for it.

I like the Template Method pattern because it forces you to structure your algorithm in a very clean way. At the same time it allows you to compare the subclasses very easily, since the common algorithm is contained in the parent (and abstract) class. All in all it's a good way to have variability and keep common features clean and organized.

Categories: Elsewhere

LevelTen Interactive: LevelTen, Open Enterprise, and 6 Strategic Advantages for Using Pantheon

Wed, 22/06/2016 - 16:04

When LevelTen gets into talks with potential clients or even current clients, our first thought is to recommend businesses to Pantheon hosting for scalable websites. When we first began looking for partners to host and manage our Open Enterprise Pro CMS, a Drupal distribution, Pantheon was a clear choice. Our company philosophy is built around providing infinitely scalable content management and marketing solutions that are simple enough for nontechnical people to manage and maintain their websites. That...Read more

Categories: Elsewhere

Mark Shropshire: Type Less with Drush site-set

Wed, 22/06/2016 - 05:53

I use drush aliases between Drupal VM and Drupal hosting services quite a bit. It was great to learn that drush site-set allows me to set the alias to use for the current session, so I don't have to type the alias name over and over again. For instance, I can set an alias like this: $ drush site-set @drupalvm.drupal8.dev, allowing me to check the status of the site on the Drupal VM with $ drush status. To make it even easier, use is an alias for site-set. Example: $ drush use @drupalvm.drupal8.dev.

Drush site-set has some other useful options beyond setting drush aliases. Check out the options available at the link below:

https://drushcommands.com/drush-8x/core/site-set/

Blog Category: 
Categories: Elsewhere

Talha Paracha: GSoC’16 – Pubkey Encrypt – Week 4 Report

Wed, 22/06/2016 - 02:00

I started the week by providing test coverage for functionalities I added to the module in week 3. Since the main functionality I added was the automatic generation of keys, the tests I wrote assert for these capabilities:

Categories: Elsewhere

Acquia Developer Center Blog: Drupal 8 Module (Distro!) of the Week: Lightning

Tue, 21/06/2016 - 23:29

Each day, new functionality is being created for and built with Drupal 8. At the same time, more and more Drupal 7 modules are also being migrated to the Drupal community’s latest major release. In this series, the Acquia Developer Center is profiling some of the most prominent, useful modules, projects, and tools available for Drupal 8. This week: the Drupal 8 Lightning distribution.

Tags: acquia drupal planetlightningdistrodistributionauthoring
Categories: Elsewhere

Zivtech: Attention: A Key Component of UX and Cognitive Psychology

Tue, 21/06/2016 - 21:30


​Technology is cool. New features are cool. Shouldn’t your site show all these cool things off?

The short answer, unfortunately, is no. All those bells and whistles rapidly overwhelm users. They may be thinking: Wow, look at this magical 3D scrolling effect! Wow, look at this video background! Wow, check out this slideshow! Wow, look at those cool drawings!

And very quickly, users get lost in the hubbub of cool things and lose track of mission. Guess what? Your website’s goal is not to show off cool stuff. It’s to get and keep visitors’ attention to your product or service, and to convert customers. That’s why it’s so important to understand how attention comes into play when designing your website.


​How Psychology Aids Website Design

Recent advances in technology spotlight two increasingly important fields: user experience (UX), or how people interact with websites and apps; and cognitive psychology, a discipline that examines mental processes such as thinking and memory.

User experience is an exemplary application of cognitive psychology, though it’s not always framed that way. In order for a user experience designer to work from a research driven, human focused standpoint, it’s necessary to understand key aspects of cognition.

Attention is one of the main tenets of human cognition. When you understand the principles of attention, you can greatly improve the way websites are designed for both the producer and the consumer.


Look Away From the Light

Psychologists used to compare visual attention to a spotlight: people set their eyes on a certain visual of a certain size and that was that. Cognitive psychologists have made great strides in the field of attention. It turns out that attention is not as limited as scientists once imagined.

Contrary to what most people assume, attention is not finite. It does not have to be focused where the eyes are looking, and it can be focused in multiple spots. People take in stimuli even if they aren’t immediately focused on them. Specific things like movement divert attention from the initial focus. Attention is not a spotlight as psychologists once thought, but rather it is an ever-shifting amorphous scan.

When you take a more holistic approach to building a website, guide the user’s attention without inducing a headache. When too many exciting things distract the user, it prevents them from accomplishing their goals.
​Order is Beauty

Strive for a visual hierarchy. Not everything should immediately try to grab the user’s attention; rather, the most important part of the website should be obvious. Some websites have begun to prioritize the user’s attention-- for example, Zivtech’s blog page phases out the header image by blurring it as the user scrolls down, shifting focus to the articles below.

​Anyone can tell you that a web page looks cluttered, but a good designer should know how a cluttered web page impacts user attention. So if you want to boost your site metrics like traffic, session duration, and conversion, pay attention.

Categories: Elsewhere

Dries Buytaert: The long path to being understood

Tue, 21/06/2016 - 19:29

I sent an internal note to all of Acquia's 700+ employees today and decided to cross-post it to my blog because it contains a valuable lesson for any startup. One of my personal challenges — both as an Open Source evangelist/leader and entrepreneur — has been to learn to be comfortable with not being understood. Lots of people didn't believe in Open Source in Drupal's early days. Some people still don't understand why you'd give the software away for free. Lots of people didn't believe Acquia could succeed. It can be difficult to deal with the naysayers and rejections. In many cases, an idea takes years to gain general acceptance. Open Source software and its new commercial approaches are starting to reach that point just now. If you ever have an idea that is not understood, I want you to think of my story.

Team,

This week, Acquia got a nice mention on Techcrunch in an article written by Jake Flomenberg, a partner at Accel Partners. For those of you who don't know Accel Partners, they are one of the most prominent venture capital investors and were early investors in companies like Facebook, Dropbox, Slack, Etsy, Atlassian, Lynda.com, Kayak and more.

The article, called "The next wave in software is open adoption software", talks about how the enterprise IT stack is being redrawn atop powerful Open Source projects like MongoDB, Hadoop, Drupal and more. Included in the article is a graph that shows Acquia's place in the latest wave of change to transform the technology landscape, a place showing our opportunity is bigger than anything before as the software industry migrated from mainframes to client-server, then SaaS/PaaS and now - to what Flomenberg dubs, the age of Open Adoption Software.

It's a great article, but it isn't new to any of us per se – we have been promoting this vision since our start nine years ago and we have seen over and over again how Open Source is becoming the dominant model for how enterprises build and deliver IT. We have also shown that we are building a successful technology company using Open Source.

Why then do I feel compelled to share this article, you ask? The article marks a small but important milestone for Acquia.

We started Acquia to build a new kind of company with a new kind of business model, a new innovation model, all optimized for a new world. A world where businesses are moving most applications into the cloud, where a lot of software is becoming Open Source, where IT infrastructure is becoming a metered utility, and where data-driven services make or break business results.

We've been steadily executing on this vision; it is why we invest in Open Source (e.g. Drupal), cloud infrastructure (e.g. Acquia Cloud and Site Factory), and data-centric business tools (e.g. Acquia Lift).

In my 15+ years as an Open Source evangelist, I've argued with thousands of people who didn't believe in Open Source. In my 8+ years as an entrepreneur, I've talked to thousands of business people and dozens of investors who didn't understand or believe in Acquia's vision. Throughout the years, Tom and I have presented Acquia's vision to many investors – some have bought in and some, like Accel, have not (for various reasons). I see more and more major corporations and venture capital firms coming around to Open Source business models every day. This trend is promising for new Open Source companies; I'm proud that Acquia has been a part of clearing their path to being understood.

When former skeptics become believers, you know you are finally being understood. The Techcrunch article is a small but important milestone because it signifies that Acquia is finally starting to be understood more widely. As flattering as the Techcrunch article is, true validation doesn't come in the form of an article written by a prominent venture capitalist; it comes day-in and day-out by our continued focus and passion to grow Drupal and Acquia bit by bit, one successful customer at a time.

Building a new kind of company like we are doing with Acquia is the harder, less-traveled path, but we always believed it would be the best path for our customers, our communities, and ultimately, our world. Success starts with building a great team that not only understands what we do, but truly believes in what we do and remains undeterred in its execution. Together, we can build this new kind of company.

--
Dries Buytaert
Founder and Project Lead, Drupal
Co-founder and Chief Technology Officer, Acquia

Categories: Elsewhere

DrupalCon News: The Business of Drupal

Tue, 21/06/2016 - 19:10

Drupal is a CMS. Drupal is a framework. Drupal is a piece of software which allows us to create amazing online experiences. Drupal is its awesome community. For some of us Drupal is a way of life. But what else is Drupal?

Drupal is our business.

Categories: Elsewhere

Cheeky Monkey Media: Custom Sorting of Views Content

Tue, 21/06/2016 - 17:58
Custom Sorting of Views Content ryan Tue, 06/21/2016 - 15:58

Have you ever had a list of related items, related by say by a taxonomy term or another node, and needed some way to sort that list, fully, or even partially? If so, there are a few good views modules out there to help you out.

The Nodequeue Module

My first introduction to setting up a custom sort on a list of content was to use the Nodequeue module. Nodequeue is a multi-faceted module which has a lot of queue/listing functionality. One of which is integrating with views.

I’ll go through the steps necessary for setting up a nodequeue and linking it to your view to have it use your sorting.

Categories: Elsewhere

Acquia Developer Center Blog: How to Ensure That Your Website is Launch-Ready

Tue, 21/06/2016 - 17:08

Launching a new application can be a scary event. Many potential bottlenecks, although not readily apparent, can cause problems on the go-live day, or the first time there’s a surge in site traffic.

At Acquia, we conduct a site audit to ensure that a new site is not subject to unnecessary delays. We do this by identifying potential problems, and proposing clear and specific remediation and optimization measures during development.

That’s the big picture. Here’s a close-up view on how we do it.

Tags: acquia drupal planet
Categories: Elsewhere

ImageX Media: When Responsive Websites May Not Be Enough: Why You Need a Mobile Business App

Tue, 21/06/2016 - 16:07

Mobile usage shows no signs of slowing down. Many web design and development agencies encourage clients to deploy websites using a responsive design in place. For those in need a refresher, a responsive website is a design approach based on fluid grids and CSS3 media queries. A responsive site's layout will change based on the size (height x width) of a device.

Categories: Elsewhere

Drupal Commerce: Commerce 2.x: Unit, Kernel, and Functional Tests Oh My!

Tue, 21/06/2016 - 16:01

At the end of May, I made an initiative to move all of the Drupal Commerce tests away from Simpletest and to use the available test classes built off of PHPUnit. Why? Simpletest is a test framework within Drupal and not used by the PHP community at large.

With the KernelTestBaseTNG™ issue, Drupal core officially moved to being based on top of PHPUnit for Kernel and Unit tests. Soon more test types were to follow, such as browser tests and JavaScript testing.

Death to Simpletest, Long Live PHPUnit, Mink, and PhantomJS

We now have PHPUnit as our test framework, the choice of the greater PHP community. The browser tests use the Mink browser emulator, which anyone working with Behat should be somewhat familiar. Testing JavaScript is done by pointing PhantomJS configuration to Mink. No longer are we limited to the functionalities of Simpletest and our community to develop it.

Categories: Elsewhere

ComputerMinds.co.uk: How to write a PHPUnit test for Drupal 8

Tue, 21/06/2016 - 14:00

This article will talk you through the steps to follow to write a simple PHPUnit test for Drupal 8.

I have been doing a lot of work on Drupal 8 migrations for the past few months so that will be the focus of the test.

Step 1: Create a Fixture

To quote the PHPUnit manual:

Categories: Elsewhere

Web Wash: Debug Site Performance Using Web Profiler in Drupal 8

Tue, 21/06/2016 - 13:50

In the beginning of any Drupal project the site loads very quickly because there aren't many modules installed. But as you add modules, the performance of the site will become slower and slower.

There's always a certain point in the project where you realize it's time to look at the problem and see if it's a rogue module or some dodgy code, we've all seen this.

Trying to debug a performance issue can be tedious work. But often, it comes down to having too many queries loaded on a page.

If you're on Drupal 7, just enable query logging using the Devel module. This will show all the queries generated at the bottom of the page.

But for Drupal 8 we have something better: Web Profiler.

Web Profiler is a Drupal 8 port of the Symfony WebProfiler bundle. The port is possible because Drupal 8 uses Symfony components.

Web Profiler adds a toolbar at the bottom of every page and shows you all sorts of stats such as the amount of database queries loaded on the page, which services are used and much more.

Categories: Elsewhere

Into my Galaxy: GSoC’ 16: Port Search Configuration module; coding week #4

Tue, 21/06/2016 - 13:45

 

Google Summer of Code (GSoC), has entered into the mid-Term evaluation stage. This is a 1 week period from 21- 27 June, were students and mentors present the progress of their projects. Based on the reports submitted, students are made pass/ fail.

I have been working on porting Search Configuration to Drupal 8 in the past few weeks. If you would like to have a quick glimpse of my past activities on this port process, please go through these posts.

last week, I could learn some Drupal concepts which were really helpful for my project. In the previous versions of Drupal, the role permissions were stored in a role_permissions table in the Database. But now, in Drupal 8, the role permissions are directly stored in the role configuration entity.

So, as described above, in D7 and its preceding versions, role permissions were stored in a role_permissions database which had the role Id and the corresponding permissions. The permissions distributed to a role was retrieved in D7 using:

$permissions = role->getPermissions();

But, in D8, this is done by the

$permissions = role->getPermissions();

Another instance is that, to grant certain permissions to roles.

In D7 it was controlled by,

user_role_grant_permissions($rid, array(‘ access content’));

The role configuration entity remodels this functionality in D8 to:

$role->grantPermission(‘ access content’);

In connection with the term permissions, the most important aspect in Drupal is a hook: hook_permissions(). This hook, obviously as you might have guessed, distributes the permissions to various users; decides whether a particular user should be allowed to access a page or a content, granting and restricting the access.

This hook has been replaced in Drupal 8 by a module.permissions.yml file. This file contains the permissions and its specifications. We can write a driver function in a php file to add the dynamic permissions. This can be achieved by making a driver class in the php file and adding the behaviour of the permission we need in the member functions of the class. We also have to link this PHP file with our yml file to keep it active. This is done by adding a callback function in the yml file which references this php file.

To display special characters in a plain text string for display as HTML format, Drupal earlier versions used the function check_plain.  This had the general syntax:

check_plain($text); // where $text was the string to be processed.

This function has got deprecated in Drupal 8. This has been replaced by the \Drupal\Compoent\Utility\Html::escape($text).

 


Categories: Elsewhere

Pages