Drupal Feeds

The original purpose of the Features module was to “bundle reusable functionality”. The classic example was a “Photo Gallery” feature that could be created once and then used on multiple sites.

In Drupal 7, Features was also burdened with managing and deploying site configuration. This burden was removed in Drupal 8 when configuration management became part of Core, allowing Features to return to its original purpose.

But, as the primary maintainer of the Features module, I sadly admit that:

“Features does not actually accomplish the goal of creating truly reusable functionality.”

Let’s look more closely the classic “Photo Gallery” example. Export your Gallery content type, your Image field storage and instance, your View and Image Style into a Feature module. You can copy this module to another site and install it to create a Gallery. But what happens if your other site already has an Image field you want to share? What happens when the namespace used for the features on your new site is different from the namespace of your original site? What happens if you want to add the gallery to an existing content type, such as a Blog?

The problem with configuration in Drupal is that it is full of machine names: content types, fields, views, dependencies, etc. You are supposed to prepend a unique namespace to these machine names to prevent conflicts with other modules and project, but that means you are stuck with that namespace when trying to reuse functionality. When you make a copy of the feature module and change all of the machine names, it becomes difficult to update the original feature with any improvements that might be made on the new project.

Basically, your Feature is not actually a reusable component.

Feature Templates

Towards the end of Open Atrium development in Drupal 7, we started using an architecture that allowed reusable functionality to be layered across multiple content types. The Related Content feature added Paragraph bundles but had no opinion about which content type you added these paragraphs to. This was accomplished using the Features Template module in D7, which allowed you to create a template of configuration and use it to create multiple instances of that same configuration across multiple content types. Until now, there was no way to reuse configuration like that in Drupal 8.

Introducing: Config Actions

The new Config Actions module helps to solve this problem and provides a replacement for both the Features Template and Features Override modules for Drupal 8. Config Actions is a plugin-driven module that simply does the following:

  • Load configuration from a source

  • Transform the config data and perform optional string replacements.

  • Save the new data to a destination

These actions are read from YAML files stored within your custom module config/actions folder. When your module is enabled, each action is executed, allowing you to easily manipulate configuration data without writing any code. If you want to write code, you can use the Config Actions API to easily manipulate configuration within your own update hooks and other functions.

Creating templates

Let’s take the “Photo Gallery” example and build a template that can be used by Config Actions:

  1. Use Features to export the configuration (content type, fields, views, etc) into a custom module (custom_gallery).

  2. Move the YAML files from the config/install folder into a config/templates folder.

  3. Edit the YAML files and replace the hard-coded machine names with variables, such as %field_name% and %content_type%.

  4. Create a Config Actions YAML file that loads configuration from these template files, performs string replacement for the variables, then saves the configuration to the active database store.

One of the edited feature configuration template files (field.storage.node.image.yml) would look something like this:

  1. langcode: en
  2. status: true
  3. dependencies:
  4. module:
  5. - file
  6. - image
  7. - node
  8. id: node.field_%field_name%
  9. field_name: field_%field_name%
  10. entity_type: node
  11. type: image
  12. ...

The resulting Config Action rule looks like this:

  1. replace:
  2. "%field_name%": "my_image"
  3. "%content_type%": "my_gallery"
  4. actions:
  5. field_storage:
  6. # name of yml file in config/templates folder
  7. source: "field.storage.node.image.yml"
  8. dest: "field.storage.node.%field_name%"
  9. field_instance:
  10. source: "field.field.node.gallery.image.yml"
  11. dest: "field.field.node.%content_type%.%field_name%"
  12.  
  13. content_type:
  14. source: "node.type.gallery.yml"
  15. dest: "node.type.%content_type%"
  16.  
  17. view:
  18. source: "views.view.gallery.yml"
  19. dest: "views.view.%content_type%"
  20.  
  21. ...

Not only does Config Actions perform string replacements within the actual YAML configuration template files, but it also replaces these variables within the action rule itself, allowing you to specify a dynamic destination to save the config.

Enabling the above module will do the same thing as enabling the original Gallery feature, but instead of creating a “gallery” content type, it will create a “my_gallery” type, and instead of a “image” field it will create a “my_image” field, etc.

Reusing a Template

By itself, this isn’t much different from the original feature. The power comes from reusing this template in a different module.

In your “myclient” project, you can create a new custom module (myclient_gallery) that contains this simple Config Action file:

  1. replace:
  2. "%field_name%": "myclient_image"
  3. "%content_type%": "myclient_gallery"
  4. plugin: include
  5.  
  6. module: custom_gallery

This will cause Config Actions to include and execute the actions from the custom_gallery module created above, but will use the new string replacements to create a content type of “myclient_gallery” with a field of “myclient_image”.

The “custom_gallery” module we created above has become a reusable component, or template, that we can directly use in our own client projects. We can control the exact machine names being used, reuse fields that might already exist in our project, and customize the gallery however we need for our new client without needing to fork the original component code.

If our new client project makes improvements to the core gallery component, the patches to the custom_gallery template module can be submitted and merged, improving the component for future client projects.

Overriding Configuration

Running actions is similar to importing configuration or reverting a Feature: the action plugins manipulate the config data and save it to the active database store. Any additional imports or actions will overwrite the transformed config data. These are not “live” (runtime) overrides, like overriding config in your settings.php file in D7 or using the Config Override module in D8. The configuration stored in the database by Config Actions is the active config on the site, and is available to be edited and used in the Drupal UI just like any Feature or other imported config.

For example, here is a simple “override” action:

  1. source: node.type.article
  2. value:
  3. description: "My custom description of the article content type"
  4. help: "My custom help of the article content type"

When the destination is not specified, the source is used.  The “value” option provides new config data that is merged with any existing data. This action rule just changes the description and help text for the “article” content type. Simple and easy, no Feature needed.

Config Action Plugins

Plugins exist for changing config, deleting config, adding new data to config, and you can easily create your own plugins as needed.

The Source and Destination options also use plugins. Plugins exist for loading and saving config data from YAML files, from the active database store, or from simple arrays, and you can create your own plugins as needed.

For example, the above “override” action could be rewritten like this:

  1. source: [
  2. description: "My custom description of the article content type"
  3. help: "My custom help of the article content type"
  4. ]
  5. dest: node.type.article

This specifies the configuration data directly in the source array and is merged with the destination in the active database store.

Conclusion

Config Actions addresses many different use-cases for advanced configuration management, from templates to overrides. You can use it to collect all of your site help/description text into one place, or to create a library of reusable content components that you can use to easily build and audit your content model.  Developers will appreciate the easy API that allows configuration to be manipulated from code or via Drush commands. I look forward to seeing all the the different problems that people are able to solve using this module.

To learn more about Config Actions, read the extensive documentation, or come to my Birds of a Feather session at DrupalCon Baltimore to talk more about advanced configuration management topics.

 

Pattern Lab is many wonderful things: a style guide, a component inventory, a prototyping system, and the embodiment of a design philosophy, all wrapped inside a fundamentally simple tool – a static site generator. It has greatly improved Phase2’s approach to how we build, theme, and design websites. Let’s talk about what Pattern Lab is, how we use it in our process by integrating it into the theme of a CMS like Drupal or WordPress, and the resulting change in our development workflow from linear to parallel.

Note: We’ll be discussing this topic in our webinar on June 16th. Register here!

What is Pattern Lab?

Pattern Lab allows us to easily create modular pieces of HTML for styling & scripting. We call these modular pieces of HTML components – you may have already heard of the iconic atomsmolecules, and organisms. Pattern Lab provides an easy-to-use interface to navigate around this component inventory.

Pattern Lab also does much more: it fills the role of a style guide by showing us colors, fonts, and font sizes selected by the design process and demonstrates common UI elements like buttons, forms, and icons along with the code needed to use them. That part is important: it’s the distinction between “this is what we’re going to build” and “this is what has been built and here’s how to use it.” Pattern Lab provides a handbook to guide the rest of your complex CMS.

We can also prototype with Pattern Lab because it supports “partials.” Partials allow our components to contain other components, giving us modular components. This lets us reuse our work in different contexts by not repeating ourselves, ensuring consistency of our design across a wide set of pages and viewports, and reducing the number of bugs and visual inconsistencies experienced when each page contains unique design elements. It supports either low fidelity “gray-boxing” or high fidelity “it looks like the finished site” prototyping. You can see an example of this by looking at the “Templates” and “Pages” in Pattern Lab below.

To summarize, Pattern Lab is a style guide, a component inventory, and a prototyping environment where we can see our designs in the medium they are destined for: the browser! Now, let’s talk about the old way of doing things before we discuss how we implement this tool, and the difference the new way makes.

The Old Way

Generally speaking (and greatly simplifying), the old process involved several linear steps that effectively block subsequent steps: the goal of each step is to create a deliverable that is a required resource for the next step to start. The main point I want to make is that in order for the front-end developers to implement the designs they need HTML, so they have to wait for the back-end developer to implement the functionality that creates the HTML.

Front-end developers just need HTML. We don’t need the HTML required for the complex logic of a CMS in order to style it. We just need HTML to style and script so we can create our deliverables: the CSS & JavaScript.

To reiterate this point: front-end devs just need HTML, wherever it comes from.

Now that we’ve set the stage and shown the problem, let’s take a look at the way we implement Pattern Lab and how that helps improve this process.

Integrating Pattern Lab and the CMS Theme

Instead of keeping our Pattern Lab site (which contains our prototype and style guide) separate from the CMS, we keep them together. Pattern Lab is just a simple static site generator that takes HTML shorthand and turns it into HTML longhand. We just put the Pattern Lab folder inside the theme right here (for a Drupal site): /sites/all/themes/theme-name/pattern-lab/. Now it’s next to other fundamental assets like CSS, JavaScript, Images, and Fonts. Sharing these assets between Pattern Lab and our CMS is a huge step forward in improving our process.

Folder Structure

theme-name/ css/ style.css js/ script.js pattern-lab/ source/ # (HTML Shorthand) public/ # (HTML Longhand - a.k.a The Pattern Lab Site) templates/ *.tpl.php # (All our CMS template files)

1

2

3

4

5

6

7

8

9

10

theme-name/

css/

style.css

js/

script.js

pattern-lab/

source/ # (HTML Shorthand)

public/ # (HTML Longhand - a.k.a The Pattern Lab Site)

templates/

*.tpl.php # (All our CMS template files)

Sharing CSS & JS Assets

With Pattern Lab inside our CMS theme folder, all we really need to do to “integrate” these two is include this HTML tag in Pattern Lab to use the CSS that our CMS theme is using:

1

<link href="../../../../css/style.css" rel="stylesheet" media="all">

And then include this HTML tag to use the CMS theme’s JavaScript:

1

src="../../../../js/script.js">

How This Helps

All a web page needs is HTML for its content, CSS for styling that content, and JavaScript for any interaction behavior. We’ve now got two ways to make HTML: programming the CMS (which takes a lot of time) to be able to let non-technical content editors create and edit content that generates the HTML, or using Pattern Lab to write “HTML shorthand” much, much quicker. Both of those environments are linked to the same CSS and JavaScript, effectively sharing the styling and interaction behavior to both our CMS and Pattern Lab.

Now, most of the time we’re not working with our clients just to make style guides and prototypes; we’re making complex CMS platforms that scale in some really big ways. Why would we want to waste time creating the HTML twice? Well, sites this big take time to build right. Remember that the front-end developers are usually waiting for the back-end developers to program in the functionality of the CMS, which ends up creating the HTML, which the front-end developers style by writing CSS & JS.

All we need is some HTML to work with so we know our CSS and JS is working right. We don’t care if it’s editable to content editors at this point, we just want it to look like the comps! Now that front-end devs have an environment in Pattern Lab with real HTML to style and script, we can bring the comps to life in the browser with the added benefit of CSS & JS being immediately available to the CMS theme. We are effectively un-blocked, free to work outside the constraints of a back-end bottleneck. This shift from a linear process to one where back-end and front-end development can happen concurrently in a parallel process is a major step forward. Obvious benefits include speed, less re-work, clarity of progress, and a much earlier grasp on UI/UX issues.

The New Workflow

With our style guide sharing CSS & JS with our CMS theme, we can pull up Pattern Lab pages exposing every button – and every size and color button variation – and write the CSS needed to style these buttons, then open up our CMS and see all the buttons styled exactly the way we want. We can get an exhaustive list of each text field, select box, radio button and more to style and have the results again propagate across the CMS’s pages. Especially when armed with a knowledge of the HTML that our CMS will most likely output, we can style components even before their functionality exists in the CMS!

As the back-end functionality is programmed into the CMS, HTML classes used in the Pattern Lab prototype are simply applied to the generated HTML to trigger the styling. It doesn’t matter too much if back-end or front-end start on a component first, as this process works in either direction! In fact, design can even be part of the fun! As designers create static comps, the front-end devs implement them in Pattern Lab, creating the CSS available in the CMS as well. Then, the Pattern Lab site acts to the designers as a resource that contains the summation of all design decisions reflected in a realistic environment: the browser. The designers can get the most up-to-date version of components, like the header for their next comp, by simply screen shooting it and pulling it into their app of choice. This frees the designers from the minutia of ensuring consistent spacing and typography across all comps, allowing them to focus on the specific design problem they’re attempting to solve.

When designers, front-end developers, and back-end developers are iteratively working on a solution together, and each discipline contributes their wisdom, vision, and guidance to the others, a very clear picture of the best solution crystallizes and late surprises can often be avoided.

This parallel process brings many advantages:

  • Front-end can start earlier – often before a CMS and its environment is even ready!
  • Easy HTML changes = quick iteration.
  • Back-end has front-end reference guide for markup and classes desired.
  • Pattern Lab acts as an asset library for designers.
  • Project managers and stakeholders have an overview of progress on front-end components without being encumbered by missing functionality or lack of navigation in the CMS.
  • The progress of each discipline is immediately viewable to members of other disciplines. This prevents any one discipline from going down the wrong path too far, and it also allows the result of progress from each discipline to aid and inform the other disciplines.
  • Shared vocabulary of components and no more fractured vocabulary (is it the primary button or the main button?). Pattern Lab gives it a label and menu item. We can all finally know what a Media Block objectively is now.

Conclusion

By decoupling the creation of a design system based in CSS and JavaScript (styling) from the process of altering the HTML that our CMS is generating (theming), we’re able to remove the biggest blocker most projects experience: dependence on the CMS for CSS & JS to be written. We avoid this bottleneck by creating a nimble environment to build HTML that allows us to craft the delieverables of our design system: CSS & JS. We’re doing this in a way that provides these assets instantly to the CMS so the CMS can take advantage of them on the fly while the site is being built concurrently, iteratively, and collaboratively.

Helpful Links

DrupalCon 2017 may be over, but we’re still feeling the impact. Last week 20+ Phase2 team members and over 3,000 sponsors, attendees, and speakers converged on Baltimore for 5 days of Drupal.

In case you weren’t able to join us in person, here is a recap:

 

Impact At The Phase2 Booth

At this year’s conference, we focused on highlighting the impact digital technology, and specifically Drupal, has and can have on the world around us. We also drew attention to the fact that technology would be nothing without the incredible vision and talent of the people who fuel it.

Phase2’s booth was designed to showcase our event theme: “Vision + Technology: The Impact Is Infinite.”

We believe, and are energized by the fact, that digital technology allows one person to reach billions, with the simple stroke of a key.

And we know that the impact doesn’t end there...

When a vision is combined with technology, we have the power to set something into motion, the outcome of which is not entirely known. Actions build upon one another and inspire reactions, putting transformation entirely within reach - the impact of which is infinite.

We took our impact message and created a one-of-a-kind, interactive voting installation in the Phase2 booth. The voting station empowered DrupalCon attendees to come together and offer  their input by voting on important community issues.

DrupalCon attendees voted by completing the following sentences:

  • I want to live in a word where ______ doesn’t need an initiative, it’s just a given.

  • With _________, anything is impossible.

  • The impact of _______ is endless.

  • If we focused more on ________ what we can achieve is infinite.

With the words:

  • Privacy & Security

  • Accessibility

  • Community

  • Education

  • Diversity

Each vote deposited a corresponding color of sand in a plexiglass container. Voting data was displayed visually in real time as each person’s vote contributed to a unique piece of sand art.

 

The Results of the Vote

The final results are in and DrupalCon attendees voted to make an impact on “education”. In response to the vote, Phase2 will make a donation to The Digital Harbor Foundation, a local Baltimore youth tech education nonprofit. We were thrilled by the participation in our booth and inspired by the beauty of the final sand art and how it really was a great visual representation of  what we can achieve as a community!

 

 

Impacting the Drupal Thought Leadership

Phase2 was represented in six DrupalCon sessions and we were excited to invite some amazing clients on stage with us, including Pinterest, Turner (NBA), Score and Weight Watchers. Here’s the full session lineup - feel free to check out the video of each session:
 

One great Phase2 moment involved our Director of Engineering, Tobby Hagler, and his Dungeons & Dragons themed session. As a major D&D fan, Tobby has submitted this talk to DrupalCon multiple times over the years, and this year it was finally accepted! To commemorate his perseverance and the awesome subject matter we created a D&D themed t-shirt that everyone from Phase2 wore in support.

 

Caitlin Loos and Chris Bloom spoke on the success of Phase2’s BuilDesign Internship Program and offered some insightful strategic and tactical advice to agencies that are looking to build their own junior talent program. Watch the session here.  

 

 

The Impact is Infinite

We’re back from DrupalCon Baltimore exhausted, but exhilarated by the creativity and talent of the Drupal Community. We are reminded of the impact our collective talents can have on our lives and the world around us. It was an amazing week with team members, partners, clients and friends and we’re already looking forward to DrupalCon next year!

 

 

 

Goal: Getting PHP Sessions into Redis

One of several performance-related goals for NBA.com was to get the production database to a read-only state. This included moving cache, the Dependency Injection container, and the key-value database table to Redis.  99% of all sessions were for logged-in users, which use a separate, internal instance of Drupal; but there are edge cases where anonymous users can still trigger a PHP session that gets saved to the database.

For all it’s cool integrations with Symfony and its attempts at making everything pluggable or extendable, PHP session handling in Drupal 8 is still somewhat lacking. Drupal 8 core extends Symfony’s session handling in a way that makes a lot of assumptions, including one that developers won’t want to use any other native session handler, such as the file system or a key/value store like Redis or Memcached.

Session Handlers in Symfony and Drupal

PHP has some native session handling that’s baked in, and for basic PHP applications in simple environments, this is fine. Generally speaking, it works by storing session data in files in a temporary location on the host machine and setting a cookie header so that subsequent HTTP requests can reference the same session. However, since the default behavior doesn’t scale for everyone or meet every project’s needs, PHP offers the ability to easily swap out native session handlers. One can even create a user-defined session handler, thanks to PHP 5’s SessionHandler class.

The SessionHandler class defines some basic methods to allow a developer to create, destroy, and write session data. This class can be extended, and then ini_set('session.save_handler', TYPE) (where “TYPE” can be any of the known save handers, such as “file” or “pdo”) and ini_set('session.save_handler', PATH) (where “PATH” can be any writeable file system path or stream) can be used to tell PHP to use this extended class for handling sessions. In essence, this is what Symfony does, by extending this into a collection of NativeSessionHandler classes. This allows Symfony developers to easily choose PDO, file, or even memcached session storage by defining session handler methods for each storage mechanism.

Symfony-based applications can normally just choose which PHP session handling is desired through simple configuration. This is well-documented at Symfony Session Management and Configuring Sessions and Save Handlers. It’s even possible to create custom session handlers by extending the NativeSessionHandler, and using ini_set() inside the class’ constructor. There is no default Redis session handler in Symfony, but there are plenty of examples out there on the Internet, such as http://athlan.pl/symfony2-redis-session-handler/

Drupal 8 extends this even further with its own SessionManager class. This SessionManager class is a custom NativeSessionHandler (PHP allows “user” as one of the session.save_handler types). As part of the SessionManager class, several optimizations have been carried over from Drupal 7, including session migration and a few other things to prevent anonymous users from saving an empty session to the database. Because of these optimizations, however, we don’t want to simply ignore this class; however, the NativeSessionHandler service has the database connection injected into it as a dependency. This means future attempts to simply extend Drupal’s NativeSessionHandler service class will result in vestigial dependency injection.

Implementation

Now that we understand a little more about the underpinnings of session handling in PHP, Symfony, and Drupal 8, I needed to determine how to tell Drupal to use Redis for full session management. Several important goals included:

  • Keep all of Drupal 7 and 8’s optimizations made to session handling (which originated in Pressflow).

  • Don’t patch anything; leave Drupal core as intact as possible, but not rely on the core behavior of using the database for session storage.

  • Leverage the Redis module for connection configuration and API.

Just Override the Core Session Service?

One option that was considered was to simply override the Drupal core service. In core.services.yml the session_manager service is defined as using the Drupal\Core\Session\SessionManager class. In theory, a simple way to change Drupal’s database-oriented session handling would be to just replace the class. In this way, we would simply pretend the SessionManager class didn’t exist, and we would be able to use our CustomRedisSessionManager class, which we would write from scratch.

However, there are a few flaws in this plan:

  • We would have to reimplement all session handler methods, even if nothing differed from Drupal’s core class methods, such as session_destroy().

  • If Drupal core changed to include new or modified session handling, we would likely have to reimplement these changes in our custom code. Being off of the upgrade path or not being included in any future security fixes would be a Bad Thing™.

For more information about the proper way to override a code service in Drupal 8, see https://www.drupal.org/node/2306083

Enter: Service Decoration

For the purpose of this blog post, I will briefly introduce service decorators; but for a more general, in-depth look, a good resource to learn about Service Decorators is Mike Potter’s blog post, Using Symfony Service Decorators in Drupal 8. This is what I used as the basis for my decision to decorate the existing core session_handler service rather than overriding it or extending it.

What is a Service Decorator?

Service decoration is a common pattern in OOP that lets developers separate the modification of a service or class from the thing they’re modifying. In a simple way, we can think of a service decorator as a diff to an existing class. It’s a way to say, “hey, still use that other service, but filter my changes on top of it.”

Decorating the Session Manager Service

Symfony paves the way for services in Drupal 8, and carries with it several other design patterns, including service decorators. To decorate an existing service, you simply define a new service, and use the `decorates` key in your `MODULE.service.yml` file.

For the Redis Sessions module, here is `redis_sessions.service.yml`:

  1. services:
  2. # Decorate the core session_manager service to use our extended class.
  3. redis_sessions.session_manager:
  4. class: Drupal\redis_sessions\RedisSessionsSessionManager
  5. decorates: session_manager
  6. decoration_priority: -10
  7. arguments: ['@redis_sessions.session_manager.inner',
  8. '@request_stack', '@database', '@session_manager.metadata_bag',
  9. '@session_configuration', '@session_handler']

The `decorates` key tells Symfony and Drupal that we don’t want use this as a separate service; instead, continue to use the core session_manager service, and decorate it with our own class. The `decoration_priority` simply adds weight (or negative weight, in this case) to tell Drupal to use our service above other services that also might try and decorate or override the session_manager class.

The `arguments` key injects the same dependencies as well as the original session_manager service as a sort of top-level argument. In this way, we can still use the session_manager as the service that handles PHP sessions, and it will have all of its necessary dependencies injected into it directly by our service class. This will also inject that service into our class in case we need to reference any session_manager methods, and treat them as a _parent class method.

For the same module, here is the `RedisSessionsSessionManager.php` class constructor:

  1. public function __construct(SessionManager $session_manager,
  2. RequestStack $request_stack, Connection $connection, MetadataBag
  3. $metadata_bag, SessionConfigurationInterface $session_configuration,
  4. $handler = NULL) {
  5. $this->innerService = $session_manager;
  6. parent::__construct($request_stack, $connection, $metadata_bag,
  7. $session_configuration, $handler);
  8.  
  9. $save_path = $this->getSavePath();
  10. if (ClientFactory::hasClient()) {
  11. if (!empty($save_path)) {
  12. ini_set('session.save_path', $save_path);
  13. ini_set('session.save_handler', 'redis');
  14. $this->redis = ClientFactory::getClient();
  15. }
  16. else {
  17. throw new \Exception("Redis Sessions has not been configured. See
  18. 'CONFIGURATION' in README.md in the redis_sessions module for instructions.");
  19. }
  20. }
  21. else {
  22. throw new \Exception("Redis client is not found. Is Redis module
  23. enabled and configured?");
  24. }
  25. }

In RedisSessionsSessionManager.php, we define the `RedisSessionsSessionManager` class, which will decoration Drupal core’s `SessionManager` class. Two things to note in our constructor is that:

  1. We set $this->innerService = $session_manager; to be able to reference the core session_manager service as an inner service.

  2. We check that the module has the necessary connection configuration to a Redis instance, and if so, we’ll use ini_set to tell PHP to use our Redis-based `session.save_path` and `session.save_handler` settings.

Everything Else is Simple

In our RedisSessionsSessionManager class, there’s just a few things we want to change from the core SessionManager class. Namely, these will be some Drupal-specific optimizations to keep anonymous users from creating PHP sessions that will be written to Redis (originally, the database), and session migration for users that have successfully logged in (and may have some valuable session data worth keeping).

We also have to some extra things to make using Redis as a session handler easier. There are a few new methods that Redis Sessions will use to make looking up session data easier. Since Redis is essentially just a memory-based key-value store, we can’t easily look up session data by a Drupal user’s ID. Well, we can, but it’s an expensive operation, and that would negate the performance benefits of storing session data in Redis instead of the database.

With these custom methods aside, everything else just relies on PHP’s native session handling. We’ve told PHP to use the base Redis PHP class as the handler, which is just part of having Redis support compiled in PHP. We’ve told PHP where to save the session data; in this case, a TCP stream to our redis instance configured for the Redis module.

Bonus

As of the writing of this blog post, I’ve begun the process of releasing Redis Sessions as a submodule of the Redis module. This can help serve as both a practical example of creating a service decorator as well as helping high-traffic sites that also wish to serve content from a read-only database. For those that would like to help test the module, here is the patch to add Redis Sessions submodule to the Redis module.

Want to read more about Drupal 8 architecture solutions and how to evaluate each solution based on your business objectives? Download our whitepaper here

 

Columbia University is taking proactive steps to ensure its predominantly Drupal-based digital properties are offering the best possible experience to site visitors. Using Acquia’s Lightning distribution as a base, the CUIT team has begun to roll out a new platform on Drupal 8.

Columbia University Information Technology (CUIT) provides Columbia students, faculty, and staff with central computing and communications services. I caught up with Ian Mieville, Director of Web Services at Columbia University, to talk about how Columbia uses Drupal to support the university’s web services -- and how Drupal 8 is improving those services.

 

How does CUIT support Columbia University?

CUIT is the centralized IT department for Columbia University. We’re in charge of the university’s security and asset management, technology infrastructure, enterprise systems, as well as custom development and application work. We develop, support, and host about 300+ websites and web applications, which are all almost exclusively on the Drupal framework.

 

What were your goals for Columbia University’s new Drupal 8 platform?

The first goal was to synchronize the user experience of most CU sites. We discovered a real inconsistency of experience site-to-site -- not only with regards to design, but also usability. Users had to constantly reorient themselves every time they went to a new CU site, even if it was related to the one they just left.

So we aimed to create a standard UX where key components (search, events, news, people directories, course directories, etc.) were consistent with a single usable pattern and design. This would allow site maintainers to focus on what’s really important to them (content and information), without worrying about the technical details of digital property management. As an incentive to adopt the new standard model, we’d make this service available for free to our CU clients.

On the back-end, we found it highly inefficient to keep recreating the wheel every time we launched a new site. So our second goal was to standardize things like content types and integration patterns, and provision a single code base. This would mean our time at CUIT could be better spent doing more complex work.

 

What was your strategy to accomplish these goals?

In conjunction with our partners, we decided to develop three models of a distribution, to serve as blueprints for standardization.

The first was the Research Model, designed for use by Columbia’s labs and research institutes. The blueprint design focused on research projects, peer-reviewed journal publications, and the people running and working in the labs. It’s meant to give faculty members a platform for publishing their research, in addition to marketing to post-doc applicants.

Second, the Administrative Model will support departments like HR, Finance, and the International Student and Scholars Group. As an administrative unit, these departments exist to offer some service to Columbia’s community, so the model for their sites will give them a way to forefront popular services and organize them by personas, so as to better serve the target audience.

Finally, the Academic Model allows academic departments to showcase their course selection, faculty members, research initiatives, etc. It is formatted to be both a recruiting and informational tool for prospective and current students. This model is still being developed at the moment.

 

You designed these models on Drupal 8, using Acquia’s Lightning distribution as a base. Why Lightning?

We chose Lightning because it fit into what we were thinking already. As a distribution, it is well-suited for site maintainers and people who manage content. From the back-end, it had the tools to support that use case. And because it’s supported by Acquia, we knew we’d get timely updates. Most importantly, it was a recommendation from Phase2 Software Architect Mike Potter, who worked on this project with us early on.

 

What do other universities stand to gain from using Drupal 8/Lightning?

There’s a lot to gain from Lightning specifically and Drupal 8 in general. Drupal 8 makes it easier for us to control functionality and integration points, and support Columbia digital properties as a product and a platform.

That being said, we had a very good understanding of what Drupal 8 was offering and what we could do within those parameters. So do your research. There are a lot of contributed modules that still aren’t over to Drupal 8 yet. Choosing Drupal 8 should depend on what you want to do, and your development team’s ability to support customizations and write custom modules.

 

Any other advice for universities investing in digital transformation?

Your digital strategy depends on how centralized the university is. Columbia is very decentralized digitally, but other universities may have a central CMS where every department hangs off that main site -- I can’t speak to that.

Having said that, you should partner with those people on the other side of the IT site, ie your public affairs group. In doing that, we were able to present a more uniform front. It also makes it easier to convince departments to adopt the standard, as it’s a direct recommendation for the central administration.

With Drupal 8, there’s a little bit of a learning curve. Here at CU, we separate our front-end and back-end developers, so each of those teams learned those functions in Drupal for us. My recommendation is, if at all possible, to dedicate team members to different pieces of the Drupal ecosystem to ensure a high level of expertise in both front-end and back-end.

 

Why did you select Phase2 as a technology partner?

I previously worked with Phase2 (several times!) when I was at the College Board. When we started initiating this project at Columbia, we needed a certain level of expertise in Drupal, which I knew from experience Phase2 had. We also had other ongoing IT work, so having support from Phase2 allowed our team not to be overrun with the platform design.

It was all very seemless; we were happy to work with Chauncey, Daniel, and Mike on the project. They were really great developers and added a lot of value to the overall project.

Thanks for taking the time to chat, Ian!

I’m afraid of the Webform module's issue queue. I see the Webform 8,x-5.x module's usage stats growing and with it, duplicate bug reports are increasing. The webform_update_8025() update hook is going to haunt me for months. Now I’m afraid to write any update hook that touches an existing field definition. I’ve realized that it is time to push back on the Webform module's issue queue before it’s too late.

Hear me out: I’m not looking for a fight - just a solution to a very simple problem. People don't know how to write proper bug reports and feature requests, and they don't like to read the issue queue handbook. The solution could be equally simple, which would be to require them write good tickets.

Plenty of documentation and videos about writing good issues exist. My goal is to make it easier for people to write complete and useful tickets so I can better assist them.

Help us Help you

For now, I have three goals for improving the Webform issue queue process:

  • Provide easy-to-use bug and features templates.
  • Encourage users to employ these bug and feature templates.
  • Show users how to create a good issue.

Provide bug and feature templates

GitHub allows a maintainer to create an issue template and pull request for their repository. I have decided to do the same thing for the Webform module. Drupal.org does not really support issue templates, however I can recommend that people use them by prepopulating the issues' body field

Prepopulate the "Create...Read More

Cog, introduced in a previous post, was built as a toolset for satisfying the needs of enterprise clients by Acquia's Professional Service Front-end Team. It's used as a basic starting point for a new project and includes tools for reinforcing front-end best practices. In this blog post we will introduce you to some of the tools included in Cog.

Tags: acquia drupal planet

Building an online community is not a new topic, but the market is refocused on its growing importance because these online communities can increase customer retention, decrease customer support expenses, and increase profits.

We are excited to open our RFP process for DrupalCon North America. We are currently looking at locations for 2019 and at locations for 2020. We are running the RFP process concurrently for both years.

If you've attended DrupalCon in the past, you know that it is a pretty unique event. It brings together 3,200 people from across the globe to build Drupal, outline the future of the project, learn skills, teach others, and propel the project forward.

If you are eager for your city to host a DrupalCon we recommend you send this link to your city's Convention Center or Tourism Bureau. We have begun outreach to cities that our DrupalCon team, and the community, have identified as a good fit. That said, we are always welcome to suggestions.

All of the RFP needs are outlined in any of the documents in this folder. Note - the documents are different file formats, however the contents are identical. All proposals must be submitted by May 30, 2017, 5pm PST

If you are a convention center or tourism bureau and have any questions, feel free to reach out directly to us.

We appreciate your interest in DrupalCon and can't wait to tell you where the next Con will be!

React and Drupal 8 with JSON API 1/3 christophe Tue, 16/05/2017 - 22:30 The goal of this serie of posts is to achieve quickly a simple museum Audioguide web app based on a React isomorphic boilerplate with a Drupal 8 backend that uses the latest standards. The web app will be fully decoupled by being hosted on another domain than the Drupal one. As a real world case, we want it to be fully multilingual. This is the first post of a serie of 3. This first one focuses on having a Drupal and React setup that meets our requirements. The second one will define a MVP that will just fetch the audioguides list and a detail view (GET operation), the last one will then add extra features like getting user feedback (POST operation).

As I write, we're in the midst of a big Ransomware attack. Millions of computers have been infected, with their data encrypted, held ransom pending an extortion payment or deleted. Supposedly.

There's a very simple way to avoid the catastrophe of losing everything due to an attack like this. And it's nothing new, it's something we've known to do all along: make good backups of everything, all the time.

Securityhacked siteransomwareDrupalWord PressDrupal Planet
Introduction 10 years ago (at the end of 2006), Drush appeared to make it easy for Drupal developers to do… Read More

In this article, I'll show how you can create a custom checkout pane for Drupal Commerce in Drupal 8. For this purpose, we'll create a checkout pane with a configuration form and ability for users to add coupons to their order.

Drupal Planet, Drupal 8, Drupal modules

While, a drupal developer is working on a project, adding custom codes or functionalities is one of the unavoidable things to do. Otherwise known as extensions or modules in drupal. Drupal modules do not come packed with the core built of drupal and often has to be navigated and found on drupal.org. But is does not end there, you have to know the exact task or functionality the drupal module will add.

The solution to extensive module search may end with drupal distributions. Making a big fat functional website with the perfect drupal modules would be so much easier if someone would do that for us and we could download it whole as a package, well that is what distributions are for.

A drupal distribution…

The easiest way to effectively test your Drupal 8 site - Behat 3 with the Behat Drupal extension is an incredible tool for keeping your project out of trouble.

READ MORE

 

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 Moderately Critical security release for an Access Bypass vulnerability the Legal module.

The Legal module displays your Terms & Conditions to users who want to register, and requires that they accept the T&C before their registration is accepted.

It had a bug where a specially crafted URL could allow anyone to login to a user account that hadn't yet accepted the terms and conditions. This is mitigated by the fact that an attacker must have a way to obtain the URL, possibly by snooping on web traffic that isn't protected via HTTPS or a man-in-the-middle attack.

(A note about the timing of this release: per our agreement with the Drupal Security Team, we were unable to release this patch until the same vulnerability was fixed for the Drupal 7 Legal module, or two weeks went by after that module was unsupported, if it appeared it wasn't going to be fixed. The fix for Drupal 7 was released today.)

Here you can download the Drupal 6 patch.

If you have a Drupal 6 site using the Legal 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).

Lessons from Our Drupal 8 Blog Migration Shannon O'Malley Wed, 05/17/2017 - 14:29

Late last year, we upgraded our blog from Drupal 7 to Drupal 8. Our main objective was to invest in our skills within Kalamuna so we could, in turn, better serve our clients. We have a lot of Drupal 8 migrations lined up over the course of the next year or so, and we foresee many more coming down the pipeline. This gave us a chance to learn the ins and outs of Drupal 8, with the added value of sprucing up our very own blog. This post is a summary of takeaways from our experience that I hope will help you on your own Drupal 8 adventures.

Categories Articles Drupal Git Guidance Information Architecture Responsive Design
Last time, we gathered together DrupalCon Baltimore sessions about Case Studies. We promised that we will also look in some other areas. Therefore, we will this time explore the sessions from Project Management. Project Managers ARE the new Content Strategists by Lynn Winter from August Ash The session is about Project Managers being a content strategist. They become so because nobody has money to pay for a content strategist. Therefore, a session walks you through the discovery, design, and build phases of a website redesign sharing tips, tools, and examples of steps you can take to… READ MORE
Thursday, May 18 2017 marks the sixth annual Global Accessibility Awareness Day (GAAD). The purpose of GAAD is to get everyone talking, thinking and learning about digital (web, software, mobile, etc.) access/inclusion and people with different disabilities. Promet Source is proud to support GAAD as we help our clients achieve equal access for all across their digital properties.

Acquia has announced that they will be ending the life of Mollom. As of April 2018, they will no longer support the product.

You have over a year to find a replacement. I am currently using Mollom and planning on changing mine now. Chances are, if I don't, I'll forget to change it closer to the time!

Pages