Aggregator

Drupal blog: Get involved: Participate in the beta test process for Drupal 9

1 day 13 hours ago

Drupal 9.0.0-beta1 has been released, and we are expanding the scope of our beta testing program for minor releases of Drupal core, to include this major release as well.

We need help testing the following upgrade paths:

Agencies and other organizations who are supporting ambitious Drupal 8 sites are invited to be part of the beta testing program. By participating, you can help core maintainers by following the guidelines of the Beta Testing Program to install the beta core release on real-world examples of Drupal websites, in their staging environments. Beta testers can then provide feedback to the core maintainers about any issues they see running the beta core release in a structured way.

Being part of the Beta Testing Program is a key contribution to the Drupal project and also helps organizations to be very aware of any changes relevant to their supported websites.

Would your organization, and the Drupal project, benefit from participating in the Beta Testing Program? We'd like to get as many organizations involved as possible, so we can have a robust test of Drupal 9 before the release date. 

You can apply to join here:

Apply to participate in the program

Who should apply?

Agencies and site owners who maintain large and complex Drupal 8 production sites. In particular, sites that use a wide range of contributed and custom modules or have large volumes of content.

How can I get ready? 

To prepare for testing these upgrade paths, the best thing to do is to install and run the Upgrade Status module. This module will tell you which of your installed modules are already ready for Drupal 9. You can also check your custom code using the Drupal Check command line tool, and even generate fixes for common incompatibilities using Drupal Rector

How will participants benefit from contributing in this way?
  • All organizations and individuals taking part in the testing will receive contribution credit for both testing the update and fixing any issues that arise.
  • Updating early helps find issues beforehand, rather than after the release is out.
  • Reporting issues encountered lets you tap the wealth of experience of the Drupal core contributors that you'd not have the same level of access to if you update on your own after the release.
  • You'll have satisfaction in the knowledge that you helped shape the next major release of Drupal core.

Kalamuna Blog: How to work from home: Top tips from our remote team

1 day 14 hours ago
How to work from home: Top tips from our remote team Patricia Rodriguez Thu, 03/26/2020 - 14:17

Working from home (aka telecommuting) can be great for productivity and employee happiness. But not everyone is used to it – or prepared to do it (and many have been forced to recently because of COVID-19). At Kalamuna, we work on a distributed team, which means that most of us already work from home – and some of us are also used to setting up temporary workstations while travelling. It’s not always easy (or ideal), but a few small adjustments can make a big difference. Here are some of our team’s top tips for working effectively from the homefront.

Categories Community Fun Guidance Project Management Responsive Design Author Patricia Rodriguez

Specbee: How to Create a Covid-19 Response Announcement on your Drupal 8 website

2 days ago
How to Create a Covid-19 Response Announcement on your Drupal 8 website Akshay Devadiga 26 Mar, 2020 Top 10 best practices for designing a perfect UX for your mobile app

The Covid-19 pandemic has shaken the entire world. The future seems uncertain and things aren’t going the way as planned. Yet, businesses must hang in there and assure their users on what they should expect from them. We have helped some of our clients create banner announcements on their Drupal websites to let their customers know –

  • They are still operational 
  • Their working hours
  • How they can help better in these uncertain conditions
  • Precautionary actions that are underway
  • Restrictions on available services
     
  
     Great Southern Homes' Covid-19 Response Announcement

Of course, these announcement banners can be leveraged for any kind of informational messages that need to be displayed for a certain period of time. Let’s take you through this in two different ways. One is by creating a custom pop-up for announcements using Bootstrap modal in Drupal 8. This method offers more flexible customizations and detailing. The other option is a simpler one using the Drupal 8 Site Alert module.

Creating a custom pop-up for announcements using Bootstrap modal In Drupal 8

For a fully customized announcement banner with a decent theming, editable announcement based on the user’s selection, we can go with this option. Showing banners to the visitors depends on the selection made in the configuration form.

Step 1: Since we are building a custom announcement banner, we need to have a custom module as every feature in Drupal is a module. Build the custom module according to these instructions

Step 2: Also, the announcement needs to be configurable. We need to create an editable configuration form with required field. Follow these instructions to create configuration forms.  

Step 3: Create a plugin block for fetching the configuration form values in a custom module. Follow these instructions to create the custom block. All the validations and access should be handled within the plugin block. We will need to attach the configuration value to Javascript to build a modal pop-up in JS.

Step 4: Create a libraries.yml for defining the libraries for displaying the modal popup using bootstrap. Also Write a Javascript logic to render the announcement data into the modal. Follow these instructions to add JS to the Drupal 8 module. 

Step 5: Create a menu link for easy navigation in the custom module according to these instructions

Step 6: Place the created block in a region for the configurations provided in custom configuration form.

Now you should be able to see the pop-up in the region for the specified path based on the configuration selection.

 
   Custom pop-up for announcements using Bootstrap modal In Drupal 8Creating site announcement banners using the Site Alert Drupal module

This Drupal module has been around since Drupal 7. The Site Alert Drupal module is lightweight and simple which lets you create a site-wide informational message. It allows you to specify a start date and expiration date, severity of the alert message that is symbolized by the background color of the announcement and the content. 


Setup –

1.Enable the Site Alert module

Configuration->System->Manage Site Alerts in path

 2.Create the announcement/alert

admin/config/system/site-alerts

3. Place and configure the Site alert block from block layout according to your requirements

Structure -> blocks
              Image source - Drupal.org

 

                    
                                 Site Alert

 

We hope this information helps developers and site owners in keeping their customers informed on the changes that Covid-19 has brought about to their business operations. 

Drupal Planet Shefali ShettyApr 05, 2017 Subscribe For Our Newsletter And Stay Updated Subscribe

Leave us a Comment

  Shefali ShettyApr 05, 2017 Recent Posts Image How to Create a Covid-19 Response Announcement on your Drupal 8 website Image A Peek into the UI/UX Universe (with examples) Image Drupal 8 Custom Modules – Creating efficient Drupal 8 modules with these best practices Want to extract the maximum out of Drupal? TALK TO US Featured Success Stories

Know more about our technology driven approach to recreate the content management workflow for [24]7.ai

link

Find out how we transformed the digital image of world’s largest healthcare provider, an attribute that defined their global presence in the medical world.

link

Discover how a Drupal powered internal portal encouraged the sellers at Flipkart to obtain the latest insights with respect to a particular domain.

link

Dries Buytaert: Sustaining the Drupal Association in uncertain times

2 days 13 hours ago

Today, I'm asking for your financial support for the Drupal Association. As we all know, we are living in unprecedented times, and the Drupal Association needs our help. With DrupalCon being postponed or potentially canceled, there will be a significant financial impact on our beloved non-profit.

Over the past twenty years, the Drupal project has weathered many storms, including financial crises. Every time, Drupal has come out stronger. As I wrote last week, I'm confident that Drupal and Open Source will weather the current storm as well.

While the future for Drupal and Open Source is in no doubt, the picture is not as clear for the Drupal Association.

Thirteen years ago, six years after I started Drupal, the Drupal Association was formed. As an Open Source non-profit, the Drupal Association's mission was to help grow and sustain the Drupal community. It still has that same mission today. The Drupal Association plays a critical role in Drupal's success: it manages Drupal.org, hosts Open Source collaboration tools, and brings the community together at events around the world.

The Drupal Association's biggest challenge in the current crisis is to figure out what to do about DrupalCon Minneapolis. The Coronavirus pandemic has caused the Drupal Association to postpone or perhaps even cancel DrupalCon Minneapolis.

With over 3,000 attendees, DrupalCon is not only the Drupal community's main event — it's also the most important financial lever to support the Drupal Association and the staff, services, and infrastructure they provide to the Drupal project. Despite efforts to diversify its revenue model, the Drupal Association remains highly dependent on DrupalCon.

No matter what happens with DrupalCon, there will be a significant financial impact to the Drupal Association. The Drupal Association is now in a position where it needs to find between $400,000 and $1.1 million USD depending on which scenario we are forced into.

In these trying times, the best of Drupal's worldwide community is already shining through. Some organizations and individuals proactively informed the Drupal Association that they could keep their sponsorship dollars or ticket price whether or not DrupalCon North America happens this year: Lullabot, Centarro, FFW, Palantir.net, Amazee Group and Contegix have come forward to pledge that they will not request a refund of their DrupalCon Minneapolis sponsorship, even if it will be cancelled. Acquia, my company, has joined in this campaign as well, and will not request a refund of its DrupalCon sponsorship either.

These are great examples of forward-thinking leadership and action, and is what makes our community so special. Not only do these long-time Drupal Association sponsors understand that the entire Drupal project benefits from the resources the Drupal Association provides for us — they also anticipated the financial needs the Drupal Association is working hard to understand, model and mitigate.

In order to preserve the Drupal Association, not just DrupalCon, more financial help is needed:

  • Consider making a donation to the Drupal Association.
  • Other DrupalCon sponsors can consider this year's sponsorship as a donation and not seek a refund should the event be cancelled, postponed or changed.
  • Individuals can consider becoming a member, increasing their membership level, or submitting an additional donation.

I encourage everyone in the Drupal community, including our large enterprise users, to come together and find creative ways to help the Drupal Association and each other. All contributions are highly valued.

The Drupal Association is not alone. This pandemic has wreaked havoc not only on other technology conferences, but on many organizations' fundamental ability to host conferences at all moving forward. Just this week, we learned that there will be no future O'Reilly conferences, including OSCON. For the many of us who attended OSCON in the past, this truly is the end of an era.

I want to thank all donors, contributors, volunteers, the Drupal Association staff, and the Drupal Association Board of Directors for helping us work through this. It takes commitment, leadership and courage to weather any storm, especially a storm of the current magnitude. Thank you!

Drupal Association blog: Drupal Association Statement re: Financial Effects of COVID-19

2 days 14 hours ago

I want to thank you for your patience as the Drupal Association continues to manage the shifting landscape for nonprofits in light of COVID-19. In my last update, I explained that our ability to pivot our plans for DrupalCon depends on governmental intervention, which has not yet occurred for the time period in which DrupalCon Minneapolis is scheduled. Unfortunately this means we're still in a holding pattern as I write this.

That said, we're not spending this time idly. Many hours are being spent with our contracted providers and modeling financial outcomes for the Association and the project.  Through all of this, it has become clear that, regardless of what happens next, we have to deal with the hard reality that DrupalCon revenue is a substantial part of what keeps the Drupal Association vital.   We estimate the revenue loss to range anywhere from $400,000 to $1.1 million.

I’m now reaching out to you to help us close this gap so we may continue to support Drupal, thrive and serve you.

As an organization, join our Supporting Partner Program or join our DrupalCon sponsor pledge to commit your funds regardless of the outcome of the current crisis.

Join as a Supporter

Join the Sponsor Pledge

As an individual, join our membership program, or if you're already a member, consider making an additional donation and/or upgrading your membership level.

Join as a Member

Both individuals and organizations can also simply make a charitable donation.

Make a Donation

Well before this crisis hit, the board and our team have focused on decreasing our dependence on event-based revenue by launching new initiatives such as Drupal Steward, increasing our focus on digital partnerships, and revamping current programs including individual and organizational memberships.  In addition, the board’s strategic planning includes continued diversification of revenue with an eye toward programs requested by our community like organizational certification and more visibility of those contributing to Drupal with time, talent, and treasure.  A pipeline of products and services are in development, but they simply aren’t ready to launch yet. 

Quite frankly, I’m heartbroken because the Drupal Association was on track to achieve many of our strategic goals, leading the organization down a more solid financial path while also expanding our capacity to meet our mission and serve our community.    Only a few months ago, I found great energy and inspiration from the vision of presenting our strategic plans and reporting on our progress to you, in person, at DrupalCon. Absent the effects of COVID-19, I would have more good news to share with you about what we are accomplishing together. 

Instead, we, like most of the world around us, are facing an unprecedented challenge that will only be solved with an unprecedented community effort.

Despite the difficulty of this news and understanding that these are uncertain times for everyone, we continue to cherish our amazing community. As I ask for your support, I want to thank those organizations who have stepped up to confirm their financial commitment: Acquia, Amazee Group, Centarro, Contegix, FFW, Lullabot, and Palantir

I hope that you will join them.

Heather Rocker
Executive Director, Drupal Association

Drudesk: Set up product attributes in Drupal easily & boost online sales

2 days 18 hours ago

The joy of e-commerce is that there are myriads of products that differ in particular details so every customer can find what suits them perfectly.

As an online store owner, you will just need to help them a little — and this will be a win-win! Flexible product management is one of the reasons to choose Drupal Commerce, an e-commerce platform for Drupal websites. Today, we will discuss one of its useful opportunities — the option to set up product attributes in your Drupal online store.

InternetDevels: Progressive Web App (PWA) integration with Drupal

2 days 21 hours ago

Every business owner strives to be fully represented in the digital world and provide the most engaging experiences both for desktop and mobile users. They might want to build a mobile app. However, the task of great web development companies is to offer alternatives to every idea.

One of these interesting choices here is a progressive web app (PWA). Read on to learn more about PWAs, what they are, what makes them beneficial, as well as progressive web apps and Drupal integration.

Read more

Tag1 Consulting: Tackling Complex Business Logic with Laravel - Tag1 Team Talk #012

2 days 22 hours ago
In this Tag1 Team Talks episode, László Horváth (Senior Laravel Developer at Tag1) joins guests Fabian Franz (Senior Technical Architect and Performance Lead at Tag1), Michael Meyers (Managing Director at Tag1), and your host Preston So (Editor in Chief at Tag1 and Senior Director, Product Strategy at Oracle) for a deep dive into why Laravel should be your choice when building a mission-critical PHP architecture that encompasses a decoupled front end in JavaScript and multi-level access control and permissioning.Read more preston Wed, 03/25/2020 - 07:07

qed42.com: Concurrent editing in Drupal 8: Possible or Not?

3 days 2 hours ago
Concurrent editing in Drupal 8: Possible or Not? Body

Drupal CMS offers a rich user interface and powerful content editing experience. There are a lot of contributed modules that enhance the system and its editing experience. One of the projects I was working with called for concurrent editing implementation. Concurrent editing simply means allowing multiple editors to edit the same content at the same time, without the possibility of conflicts arising due to concurrent actions.

In today’s editorial landscape, content creators can not only access a document countless times to revise and update content but also work with distributed teams. For this reason, concurrent editing has become among the most essential and commonly requested features for any content management solution.

The project (Layout Engine) involved configuring pages and blocks of a mobile application through Drupal.

A single page of a mobile application consists of multiple sections, these sections could contain data as per user’s locations or any other criteria. A page in Drupal was primarily a content type. We used paragraphs to configure blocks which we call widgets. So basically, a banner on the homepage of a mobile application is a widget.

These pages and widgets were configured by our client’s marketing team. Any page on the mobile app could consist of 'N' number of widgets. Due to a large number of widgets present, it was difficult for a single user to be familiar with all of them. Multiple members of the marketing team worked on the app simultaneously, making it difficult to edit the layouts/widgets. 

Thus the client needed a system where multiple users could simultaneously edit the layouts and their widgets independently.

Collaborative editing has long existed as a concept outside the content management system (CMS). It is a limitation of Drupal at the moment, and we don’t see any solution for it in Drupal core soon. A big thanks to the members of the community who contribute their code in the form of modules making solutions available to the world in a quick google search. 

We explored a couple of modules which fulfilled our requirements to some extent.

| Paragraph Frontend UI

This module provides quick editing of widgets on the view page itself. 

A user won’t have to go to the edit page and then search for the widget to update and then save the whole node. He can do it quickly on the view screen. We believed this would allow multiple users to quickly edit the widgets and will solve the issues. But, it turned out that the module throws a deadlock error when multiple users are updating different paragraphs of the same node. Therefore, we discarded the possibility of using the Paragraph Frontend UI  module.

The next module we explored was the Paragraph Edit module. It provides a separate page to edit the paragraphs through the contextual links. It does not break when multiple users attempt to edit different paragraphs simultaneously. But the issue with this approach was that it supported separate editing only. So if a user had to create a new paragraph/widget, he/she had to go to the edit node form. The tricky part here is, if an editor is on the node edit form while some other editor made changes through the quick link, the current form will contain the old data. In this case, when a user saves the node, it will revert those changes to the previous version. We did not want that either.

| Conflict

It does not have any additional configuration attached to it. I am adding two screenshots below to show how it works. This is what the second user will see when the first user has already saved the node and content is in the database. To know more visit - https://www.drupal.org/project/conflict

                

Once the user clicks on the 'resolve conflicts' button, it shows two versions of each field, something like in the following screenshot. Users have to manually update the field accordingly and need to save the content again.

This module is a good solution under the following instances:

  1. If the node form has a simple structure and the user can afford to update the content manually. In a complex architecture where we use paragraphs to provide flexibility to the editors, this will create a lot of confusion.

  2. It only works for two users as you can see in the screenshot above, it shows what is the difference in the server. If a third user is editing the content at the same time, it will override the changes of the second user.

| Content Lock (anti-concurrent editing)

As the name suggests this module locks the content for the first editor who started to edit the content. Any other editor will see the message and all the fields will be disabled for him/her.

Features of Content Lock (anti-concurrent editing): 

  1. The lock will break when the user saves the content. The other user will see the message and will know who is editing the content at the moment.

  2. If a user doesn’t save the content, it has a submodule called content_lock_timeout where we can set a time for the content to hold the lock. It breaks the lock on cron run as well as when the second user comes to the edit node.

  3. It has an option to manually break the lock as well, so a user with the permission to break the lock can also free the content from the editor.

The content lock was used until we had a proper solution for concurrent editing.

After countless discussions with the marketing team, we decided to provide a solution to overcome the concurrent editing problem. We decoupled all the widget creation as a separate node and referred those nodes into the Layouts. This way, everybody had control on their own widgets and they did not need to wait for the content lock to end.

 

If you happen to have a better solution for concurrent editing, we would love to hear about it! 

 

SUMIT MADAN Wed, 03/25/2020 - 14:49

Specbee: A peek into the UI/UX universe (with examples)

3 days 23 hours ago
A peek into the UI/UX universe (with examples) Fawaz Ahamed M 24 Mar, 2020 Top 10 best practices for designing a perfect UX for your mobile app

If you have studied some form of software design or are into designing, you should be familiar 
with the terms - "UI" and "UX". Yet, sometimes we tend to use both these words interchangeably. 
So, what sets UI apart from UX?
UX design is what makes an interface functional in its simplest forms and UI design is what makes an interface appealing and beautiful.

What is a UI Design? 

User Interface is something that a user uses to interact with a product or a service. As with the design of user experience, user interface design is a complex and challenging task. It is responsible for translating the creation, analysis, content, and layout of a product into an appealing, guiding, and responsive user interface.

  • User Interface design is all about how the product’s interface looks. This considers all of the interface's visual and interactive elements— including buttons, icons, spacing, typography, color schemes and responsive design.
  • The aim of UI design is to visually direct the user through the interface of a product. It's all about having a good experience that doesn't take too much thought and effort from the consumer.
  • A good UI design ensures the design is consistent and aesthetically pleasing. 
 What is a UX Design?

User Experience is an overall experience of a user when they interact with the products or services.

  • User experience design is a method of improving and enhancing the functionality of the user-interaction.
  • UX concept is NOT about visuals; it's based on the overall experience.
  • UX isn't just about making the consumer satisfied, however. It is about helping the customer to accomplish their activities in the best possible way and attain business objectives.
                                             Image source - Dribbble

User experience design is the process of designing and enhancing the consistency of a user's engagement with all facets of a business and thereby improving the user experience.
As of the current situation within the digital globe, every business tries to make an impact on user in order to multiply its sale and to provide a happening experience for a consumer all with help of User Experience and User Interface design.

How can a CMS like Drupal 8 help enhance the UX of a website? 

A Content Management System plays a key role in the success of a website’s UX design. Drupal 8 offers flexibility in customizing content as well as design. Let’s look at how is Drupal 8 a great choice of CMS if you are looking at creating compelling UX designs.

  • Page Speed – Fast-loading websites not only enhances the performance but also the overall user experience. Drupal 8 provides performance boosting features like advanced caching options, image optimization, code optimization, database optimization and more.
  • Responsive – With Drupal 8, responsiveness runs in the blood. Which means that all Drupal 8 websites are responsive out-of-the-box! And without a responsiveness, the UX of a website is incomplete.
  • Personalization – It has been proven that websites that offers personalized experiences see more conversions than websites without it. Drupal 8 offers various modules that let you personalize your content based on the user’s demographics, device information, date and time of login and more.
  • Multi-lingual – Did you know that only 20% of the world’s population can speak / understand English? To be able to provide a personal touch through the UX of a website, it is important to speak with the user in the language they are comfortable with. Drupal 8 offers multi-lingual support out-of-the-box with over 100 languages to choose from.
  • Headless Drupal Decoupling Drupal gives UI/UX designers a lot more control over the design elements of a website. When front-end frameworks like ReactJS and Angular JS are leveraged with Drupal 8, the user experience can be enriched. 
  • Themes – The Drupal community has built hundreds of themes that can be adapted to any business requirements. You can find Drupal core themes that come out-of-the-box with Drupal 8 as well as third-party Drupal 8 themes. If none of them suit your needs, you can also customize a theme to have them tailor fit.
How does UX differ from UI?

Here is an analogy I like to use to describe the difference between both.
If you imagine the human body to be a product. The organs reflect the UX design: measuring and optimizing to support life and UI design reflects the body's cosmetics; their appearance, their senses yet their reactions. 
The key distinction to remember is this: UX design is all about the overall feel of the user while UI design is all about how the interfaces of the product look and work.

                        Image source - Dribbble 

For instance, User Experience (UX) is mostly emotional and is the consumer's mental actions, like how a user reacts when using a product or what emotions he feels during the usage of a product.

It mostly deals with what goals users are trying to achieve via the product, what their needs are, what feelings are they experiencing, what strategy is to be applied, and what interactions are they likely to perform in order to reach their goals.

Whereas User Interface (UI) is tangible. It mostly deals with the visual hierarchy of the product, including buttons, typography, colors etc. UI designers basically have to deal with scalable designs and have to improve the user flows by reducing the time required for a user to reach his goal while making the product aesthetically pleasing and visually beautiful for the user.

Good and Bad UI/UX Examples

Let’s talk about a few bad examples of UI/UX

                    Distractions create bad first impressions

When looking at the above example at the first sight, it gets rather confusing about what the website is all about. A user is shown various ads and unwanted information and is presented with a lot of information that is difficult to be processed, hence making users bounce off the website without even reading the news posting which they were looking for in first place.

These are some more bad examples of UI/UX.

When looking at the above two images, a user gets confused and is likely to be diverted from his actual goals. In 2020, responsive designs are not a trend but a necessity. The above examples show the bad and harsh usage of colors and typography leading to confusion.

But not every design is bad. Let’s also talk about some of the very good examples of UI/UX.
The above example shows how a simple micro-interaction can make a user happy and engaged, leading to some immersive experience.

 

First impressions have lasting effects. The UI / UX of your website is the face of your brand that can captivate and engage your audience. Drupal 8 offers multiple ways to enhance the user experience of a website. Want to create immersive digital experiences to attract and enthrall your users? We would be happy to help!

Drupal Planet Shefali ShettyApr 05, 2017 Subscribe For Our Newsletter And Stay Updated Subscribe

Leave us a Comment

  Shefali ShettyApr 05, 2017 Recent Posts Image A peek into the UI/UX universe (with examples) Image Drupal 8 Custom Modules – Creating efficient Drupal 8 modules with these best practices Image Top 8 Drupal 8 Themes for Media and Publishing Websites Need help creating compelling UI/UX designs for your website? Talk TO US Featured Success Stories

Know more about our technology driven approach to recreate the content management workflow for [24]7.ai

link

Find out how we transformed the digital image of world’s largest healthcare provider, an attribute that defined their global presence in the medical world.

link

Discover how a Drupal powered internal portal encouraged the sellers at Flipkart to obtain the latest insights with respect to a particular domain.

link

MidCamp - Midwest Drupal Camp: MidCamp 2020 is in the bag

4 days 14 hours ago
MidCamp 2020 is in the bag We did it!
  • 3370 Zoom sessions
  • 2086 minutes of recordings (& captions!)
  • 234 peak simultaneous participants
  • 143 new Slack members
  • 41 Discord accounts 
  • 18 first-time contributors trained
  • 3 movies watched remotely
  • 1 incredible virtual event!

MidCamp 2020 is in the bag, and what a whirlwind it was. Over the course of 10 days our volunteer organizers and speakers worked tirelessly to pivot our usual in-person format to 100% virtual, and it wouldn’t have been possible without every single one of you who joined us. 

Through the hard work of the Drupal Recording Initiative and with thanks to Bounteous, you can catch up on anything you missed on YouTube and Drupal.tv. In a few days, those videos will be supplemented with professional captions by ACS Captions, with thanks to Clarity Partners and Pantheon.

As you’re reviewing sessions, please help our speakers by providing feedback for any sessions you attended or watch via their session page on midcamp.org. Finally, please let us know what you thought of the event as a whole on our MidCamp 2020 Survey. The reviews are already coming in, and we’re happy to have had the opportunity to share these days with you.

A+++ would MidCamp again.
- Todd Ross Nienkerk, CEO, Co-Founder at Four Kitchens

MidCamp will return. Stay tuned as we will announce 2021 dates when we can.

Jacob Rockowitz: Reusing Webform elements, behaviors, and APIs within a Drupal configuration form

4 days 17 hours ago

In my previous blog post about a few of my favorite Webform things, I expressed my appreciation for the fact that that "most of the code within the Webform module is reusable and extendable." Writing that blog post helped me re-organize and improve my presentation titled, Webforms for Everyone. While updating my presentation, I found explaining and showing how the Webform module’s APIs are reusable is very challenging. As the Webform module has grown and gotten more complicated, I have continually improved the examples and demos included in the module. These examples have helped developers understand how to extend the Webform module. As a result, I decided the best way to show how the Webform module's APIs - specifically form elements and behaviors - are reusable, was to create an example.

The Webform Custom (Configuration) Form example

The goal of the Webform Custom (Configuration) Form example is to show how to leverage Webform APIs outside of the Webform module. For instance, webform elements can be used within a Drupal configuration forms. A very basic reusable enhancement is attaching the Webform module’s JavaScript to warn users about unsaved changes.

A more advanced example is reusing the Webform module's multiple element widget to collect rich data. Recently, I had to create an arbitrary list of node ids stored within a configuration file. In doing so, I was able to use Drupal’s entity autocomplete element combined with the Webform module’s multiple element support.

The below example shows how to use a multiple entity autocomplete element with the unsaved changes behavior within a configuration form.

The above example was created using the below code snippet.

Using a code generator to create examples

Code generators like Read More

Mediacurrent: How to: Syntax Highlighting with Decoupled Drupal

4 days 19 hours ago

In this post, I’m going to be showing a recipe for how to add syntax highlighting and code segments to a decoupled Drupal site. Want to see an example? It’s right in front of you! The code blocks down below use prism.js, React and Code Snippet module, just as they explain.

First, install Code Snippet module on your Drupal 8 site. This module integrates the “codesnippet” ckeditor plugin, which provides a button that does the following:

  • It gives editors a WYSIWYG button that lets them choose a language and embed a code snippet.
  • Behind the scenes, it escapes and encodes the pasted code segment so that html tags and php tags do not get stripped.
  • Provides a pretty good visual treatment of the code segments when displayed in Drupal. (You could just use this if your site is not decoupled, but I’ll be going one step further to show how to apply syntax highlighting in React).

Get Code Snippet via Composer, like this:

composer require drupal/codesnippet

You also have to put the library in place. First, add the following to your projects composer.json

{ "type": "package", "package": { "name": "ckeditor/codesnippet", "version": "4.11.4", "type": "drupal-library", "dist": { "url": "https://download.ckeditor.com/codesnippet/releases/codesnippet_4.11.4.zip", "type": "zip" } } },

Check for the most current stable version. Next, require the new package using Composer CLI

composer require ckeditor/codesnippet

After that’s done, turn on the module

drush en -y codesnippet

Now it’s time to add the code snippet tool to one of your WYSIWYG profiles on a text format. In our case, we have WYSIWYG  UI on the “Full HTML” text format.

Navigate to Content Authoring > Text Formats and Editors (/admin/config/content/formats), and configure the text format containing the WYSIWYG profile you want to modify:

If you have installed Code Snippet module and its library correctly, you should see a little button in the ckeditor staging area that looks like this:

Drag that down into the active buttons tray, and save.

It’s time to edit one of your articles and try out the new code snippet tool. Once you’ve found an article, edit and verify that the code snippet icon is there. Give it a click, and you should see a modal asking you to paste in some code:

Time to show off your code! You’ll find the Code Snippet module to be quite nice - as you add code blocks, it styles it pleasantly in the WYSIWYG area and also when you view the node:

Are you building a decoupled site? No? Then you’re done!

If you are stopping here, I will give one warning - Code Snippet module uses highlight.js, and it is a big boy. It has the same problem as the date library moment.js: in most cases, you will only want to use a small subset of its many languages, but it comes packaged with everything. On its own, this probably won’t totally kill your site’s performance, but it definitely won’t make it better. It will stick out like a sore thumb the next time someone does a frontend performance audit.

But let’s move on - this article is mainly about syntax highlighting for decoupled sites. Let’s pretend you are building a Gatsby/React blog that gets its data from Drupal.

What we need is a syntax highlighting library that can be pulled in language-by-language, so that the bundle size stays small. I looked around for a while, and the best one I found was Prism.js.

At this point, I could probably point you to this article explaining how to add prism.js to Gatsby sites and call it a day. I’m going to repost some of that but also add a few things.

First, let’s install the prismjs npm module and some required Babel plugins. 

npm install --save prismjs babel-plugin-prismjs babel-preset-gatsby

Then, add this to your .babelrc (create this file in your project root if it doesn’t already exist):

{ "presets": ["babel-preset-gatsby"], "plugins": [ ["prismjs", { "languages": ["javascript", "css", "markup"], "plugins": ["show-language"], "theme": "okaidia", "css": true }] ] }

Once you’ve got it working, you can customize these settings.

We’re almost done. The last piece of the puzzle is actually applying prism.js to your pages. There are a lot of ways to do it, but the simplest is telling prism to highlight all viable code tags it finds. Let’s say you have a “Body” component that you use to render WYSIWYG content from your CMS. You would invoke the prism.js highlighting like this:

import React, { useEffect } from 'react'; import reactHtmlParser from 'react-html-parser'; import Prism from "prismjs"; const Body = ({children}) => { const options = { decodeEntities: true, }; useEffect(() => { Prism.highlightAll(); }); return ( <div> {reactHtmlParser(props.children, options)} </div> ); }; export default Body;

Note that reactHtmlParser is just a useful tool for rendering WYSIWYG content, rather than using dangerouslySetInnerHtml.

At this point, if you do a Gatsby build (or if you’re not using Gatsby do whatever it is needed to hydrate this React component), you should see syntax highlighting in all its glory.

Now .. if you are astute .. you might be a little confused. Doesn’t Code Snippet module provide code tags that work with highlight.js? And aren’t we using Prism.js on the frontend? Sure, they both work with code and pre tags, but aren’t the class conventions different for setting language?

Turns out It Just Works™. This is really lucky! Both libraries use “language-<language>” as their class naming convention. Still, it’s worth remembering that this is somewhat brittle. One could solve this problem by contributing a plugin for prism.js to the Code Snippet module.

I hope you found this useful!