Übersicht

Vorschläge max.2 pro Tag

Platz für Vorschläge, Fragen, Anderes

Wenn sie Antworten erhalten wollen tragen sie hier Kontaktdaten wie email-Adresse oder Telefonnummer oder Postanschrift ein

CAPTCHA
Sicherheitscheck: Tragen sie die abgebildeten Buchstaben und/oder Zahlen hier unter in das freie Feld ein.
Image CAPTCHA
Enter the characters shown in the image.

Linux - here we go

Umfrage

Wie gefällt euch/ihnen diese Seite:

Vorschläge und Wünsche bitte an: support@webjoke.de.

Benutzeranmeldung

CAPTCHA
Sicherheitscheck: Tragen sie die abgebildeten Buchstaben und/oder Zahlen hier unter in das freie Feld ein.
Image CAPTCHA
Enter the characters shown in the image.
Drupal.org - aggregated feeds in category Planet Drupal
Aktualisiert: vor 2 Tage 3 Stunden

Chapter Three: National Nurses United: Supporting a Large Website

Di, 04/16/2024 - 20:15
At Chapter Three we do more than build websites from the ground up. We also support existing websites that require new or additional resources. The type of work we do is flexible and depends on the client’s needs. It ranges from basic maintenance and security updates to more substantial overhauls, cleanup, and feature enhancements.  One major website we support is National Nurses United (NNU). With nearly 225,000 members, NNU is the largest union and professional association for registered nurses in the United States. It is the country’s leading advocate for collective bargaining for RNs, regulatory protections for patients and nurses, and for guaranteed health care and expanded medicare.
Kategorien: Drupal News

Drupal Association blog: 5 Reasons to Join Us at DrupalCon Portland 2024

Di, 04/16/2024 - 20:11

Discover Why DrupalCon Portland 2024 Is the Must-Attend Event of the Year

If you're part of the Drupal community or interested in Drupal, you won't want to miss DrupalCon Portland 2024! The conference is set to be the most exciting and informative event of the year, catering to developers, marketers, content editors, content publishers, and anyone else who interacts with their website. In this blog post, I'll outline the top five reasons why attending DrupalCon Portland in 2024 is a must.

Immerse Yourself in the Ultimate Drupal Experience

DrupalCon Portland 2024 promises an entire week dedicated to Drupal and the vibrant Drupal Community. It's your chance to connect with some of the most brilliant minds in the industry, engage in discussions, build lasting friendships, and simply have a fantastic time. Key highlights of the event include:

  1. Foster Community Through In-Person Connections: Experience the warmth and synergy of the Drupal community by connecting face-to-face with fellow Drupal enthusiasts. This is a unique chance to share your passion for Drupal with like-minded individuals in a vibrant, engaging setting.

  2. Driesnote & Eminent Speakers: Gain insights from the Drupal founder during the much-anticipated Driesnote and learn from a lineup of distinguished speakers. These sessions promise to be thought-provoking, offering deep dives into various aspects of Drupal, its ecosystem, and future directions.

  3. Contribution Opportunities: Participate in contribution sprints where you can tackle real-world problems, contribute to the project, and interact with key project contributors and maintainers. This is your chance to make a tangible impact and glean insights from the guardians of the Drupal codebase.

  4. Social Gatherings and Welcome Party: DrupalCon isn't just about learning; it's also about having a great time. The Welcome Party and other social events provide perfect settings to unwind, celebrate, and build friendships in a more relaxed atmosphere. View the social events or submit yours now.

  5. Birds of a Feather Sessions: Engage in "Birds of a Feather" (BoF) sessions, where small groups gather to discuss hot topics and share knowledge on specific areas of interest within Drupal and technology. These small gatherings encourage open dialogue and are a great way to dive deep into subjects you care about with peers.

Rediscover the Thriving Drupal Community

After years of remote work and lockdowns, DrupalCon Portland 2024 provides a refreshing opportunity to step out of your home office and connect with passionate Drupal enthusiasts. Meet the faces behind your favorite modules and engage with like-minded individuals who share your love for Drupal.

Unparalleled Learning Opportunities

DrupalCon offers unparalleled opportunities for learning and growth. From inspiring keynotes and informative sessions to hands-on training and contribution sprints, this event is the ultimate platform to expand your knowledge and expertise. Break out of your routine and explore the full potential of Drupal.

This year will be filled with broader topics to help you drive your digital experiences forward. Some of the new highlights this year include:

  1. A new marketing track dedicated to driving your business goals forward.
  2. Artificial Intelligence (AI) - Learning how AI is being incorporated into Drupal and how it can help you improve your day to day and achieve your goals.
  3. Birds of a Feather - More structure and planning going into our BOF sessions to drive higher levels of engagement and inform stronger conversations.
Be Inspired by Innovations

Witness the transformative power of Drupal and be inspired by the innovative and talented Drupal community. Attendees at DrupalCon Portland are focused on:

  1. Crafting cutting-edge content management systems.
  2. Delivering groundbreaking customer experiences.
  3. Mastering their craft and pushing boundaries.
Forge Valuable Connections

DrupalCon Portland is the perfect environment to connect with individuals who share your passion for Drupal, open-source technology, and delivering top-notch digital experiences. Building relationships here can significantly impact your career, opening doors to exciting opportunities.

There are countless reasons to join us at DrupalCon Portland 2024, and we can't wait to welcome you! It's a unique opportunity to connect with the Drupal community, discover the incredible work happening within Drupal, and spend quality time with friends and colleagues from around the world who share your common passion. We look forward to seeing you there!

Register now for DrupalCon Portland 2024.

Kategorien: Drupal News

Matt Glaman: Writing tests first saves time and money later on

Di, 04/16/2024 - 15:18

The TalkingDrupal podcast had Alexey Korepov on to talk about Test Driven Development. Alexey has written the Test Helpers module, a development package that provides many useful utility tools for writing unit tests for your Drupal code.

Kategorien: Drupal News

Specbee: How to integrate Auth0 Single Sign-On (SSO) in Drupal

Di, 04/16/2024 - 08:09
If you want to offer your users a hassle-free login experience, convenience and security, Single Sign-On (SSO) is the way to go. SSO is an authentication process that allows users to access multiple applications or services with a single set of login credentials. Auth0 is an identity-as-a-service (IDaaS) platform that provides authentication and authorization services for applications and APIs. It offers a comprehensive set of features for implementing secure and customizable authentication solutions, including support for various authentication methods such as username/password, social logins, and multi-factor authentication (MFA). In this article, you will learn more about SSO and Auth0 and how you can integrate it with your Drupal website. Benefits of SSO Integration in Drupal Seamless User Experience: Integrating SSO into Drupal enables users to log in once and access all connected applications seamlessly, eliminating the need for multiple logins and enhancing user convenience. Centralized User Management: SSO centralizes user authentication and authorization, making it easier for administrators to manage user accounts, permissions, and access control policies across multiple Drupal sites or integrated applications. Enhanced Security: SSO enhances security by enforcing consistent authentication policies and enabling centralized management of user access, reducing the risk of security breaches due to weak passwords or unauthorized access. Reduced Development Efforts: By leveraging Auth0's SSO capabilities, developers can significantly reduce the time and effort required to implement authentication and authorization features in Drupal applications, accelerating the development process and time-to-market for new features and functionalities. Take a look at this article where we discussed integration of SSO with Drupal using SAML Steps to Integrate Auth0 SSO in Drupal Prerequisites Auth0 account SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider  Auth0 configuration Register to Auth0. Go to https://manage.auth0.com/ and log in. Create the tenant. To create a tenant, click on the drop-down near the logo in the top left corner. You will see a pop-up fill the required information in that pop-up like tenant name, region, and environment. Click on the Create button. Next, click on the "Applications" option in the left menu. A list will open. Then click on “Applications” on that list and you will see an application page. Click on the “Create Application” button. You will see a pop-up, enter the application name in that pop-up and select “Regular Web Application” then click on Create. Next, click on that application and go to the settings tab. In the Settings tab, you can update the application logo if you want.  In the Settings tab, add the callback URL "[Domain]/samlassertion" to the "Allowed Callback URLs" field and then click Save. Then go to the “Addons Tab”. In the Addons tab, click on the "SAML2 Web App" option. You will see a pop-up with two (Settings and Usage) tabs. In the Settings tab, add the callback URL "[Domain]/samlassertion" and click the Enable button. After this go to the Usage tab. In the Usage tab, click on the "Download" button of "Identity Provider Metadata". Drupal application configuration Install the "SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider" contrib module “https://www.drupal.org/project/miniorange_saml” in your Drupal application using composer.composer require 'drupal/miniorange_saml:^3.0' Go to the Drupal website and log in as administrator. Go to "Configuration" and then click on "MiniOrange SAML Login Configuration". Go to the “Service Provider Setup” tab Click "Add New IDP". Upload the metadata file that we downloaded from Auth0. Click on the save button. Steps to add role mapping Go to “Configuration” then click on "miniOrange SAML Login Configuration". Go to the “MAPPING” tab Click on the “Enable Role Mapping” option (If not enabled already). Select the “Library” role from the dropdown. Click on the “Save Configuration”. Then clear the cache and visit the login page.You will see an SSO login link above the submit button. Click on that link. You will be redirected to the auth0 login page If you have an Auth0 account then enter the username and password otherwise you can create an account using the signup link. After login you will be redirected to your Drupal application and your account will be logged in. Final thoughts The demand for seamless user experiences and robust security measures continues to escalate by the day. By integrating Auth0's Single Sign-On solution with your Drupal site, you're not just staying ahead of the curve — you're shaping the future of online interaction. But the journey doesn't end with integration. The next step is optimization. Continuously refine your authentication workflows, leverage Auth0's advanced features to customize user experiences, and stay vigilant against emerging threats. Reach out to our Drupal development team to enhance your user experience with features like these.
Kategorien: Drupal News

The Drop Times: A Detailed Review of Droopler 4 with Grzegorz Bartman of Droptica

Di, 04/16/2024 - 07:50
Embark on a comprehensive exploration of Droopler 4 as Grzegorz Bartman, the co-CEO of Droptica, unveils the evolutionary strides of this cutting-edge Drupal distribution in an interview with Alka Elizabeth from The DropTimes. Delve into the seamless integration of single directory components, Bootstrap 5, and the Radix theme, tailored to meet the needs of developers. Discover the user-centric design featuring 15 pre-configured components through Drupal paragraphs, responsive web elements, and robust SEO modules catering to marketing and SEO experts. Gain insights into the strategic choices driving the adoption of Drupal Paragraphs over the Layout Builder and the collaborative ethos propelling Droopler's advancement. Stay tuned to the promising future of Droopler, characterized by a steadfast commitment to SEO optimization and enhanced editor experiences.
Kategorien: Drupal News

The Drop Times: Embracing Technology with Drupal

Mo, 04/15/2024 - 22:24

In 2024, technology has reached new heights, impacting our lives like never before. With AI becoming more common and exciting updates on the horizon, technology is shaping our world significantly.

Technology continues to redefine the way we live, work, and connect. New features, updates, and innovations emerge daily, shaping our world remarkably. At the heart of this transformation lies Drupal, the dynamic content management system that empowers individuals and businesses to navigate the digital realm easily and confidently. Drupal opens limitless possibilities in website development, offering a platform where creativity knows no bounds.

Drupal streamlines the process of creating and managing websites, putting the power of customization and control at our fingertips. With its intuitive interface and robust features, Drupal allows users to craft online experiences that are not just functional but truly exceptional.

Technology is advancing rapidly, and Drupal is here to make it accessible and beneficial for everyone. With its user-friendly features and adaptability, Drupal simplifies website creation and opens doors to endless possibilities.

Let's review the latest news covered by The Drop Times (TDT) last week.

In an Interview with Alka Elizabeth, sub-editor, TDT, Irina Zaks, Co-Founder and CTO at Fibonacci Web Studio, discusses her transition from a background in physics to web development, emphasizing the importance of clear, simple solutions in complex projects. She highlights the Fibonacci sequence's role in her design philosophy, advocating for harmony and simplicity in web development. Zaks also reflects on the unique challenges of academic websites and her efforts to promote open-source software within academia, particularly through her work at the Stanford Open Source Lab. The interview is a precursor to Stanford Web Camp. 

Head to the concluding part of our series, "Drupal Page Builders—Part 4: Distributions," crafted by André Angelantoni, Senior Drupal Architect, HeroDevs. The article discusses the practicalities and considerations of using Drupal distributions for page building. It emphasizes that while distributions can simplify the setup process, especially for non-technical users, they often involve complex maintenance and may slow down upgrades due to dependency on the distribution maintainers. The piece advises conducting a proof-of-concept for the most complex page layouts to ensure the chosen solution can handle the requirements, highlighting that many teams opt for minimal module use to maintain flexibility and control.

Explore the articles curated by Kazima Abbas regarding the featured speakers who presented their sessions at EvolveDrupal Atlanta. The first part features Michael Herchel, Mary Blabaum, Allison Vorthmann, Andy Waldrop, and Jesse Dyck.  Topics range from an Inclusive Design Approach to Drupal 7's End of Life on website security and from leveraging Drupal for scalable software products to insights on migrating to Drupal 10. The second part shifts to topics including The Fourth Decade of Website Deployments, the Crossroads of Website Evolution, and the updates from WCAG 2.1 to 2.2. John Cloys, Penny Kronz, and Steve Persch are featured in this segment. 

The upcoming Drupal Developer Days in Burgas, Bulgaria, from June 26-28, 2024, at Burgas Free University, has announced Suzanne Dergacheva and Frederik W. as keynote speakers. DrupalCamp Iberia 2024 has officially announced its schedule for the upcoming gathering on May 10 and 11 at PACT in Évora, marking a significant event in the Drupal community's annual calendar. The Network of European Drupal Associations (NEDA) has scheduled a meeting on April 24, 2024, led by Esmeralda Tijhoff. This meeting aims to foster connections among Drupal Associations globally, sharing experiences and discussing support strategies.

DrupalCon Portland 2024 extends a special offer to students, recent graduates, and individuals with Drupal Training Certification obtained since 2022, providing an opportunity to purchase tickets for the event at a discounted rate of $50. The DropTimes has been announced as the official media partner for The LagoonCon Portland 2024. DrupalSouth has made their talks from DrupalSouth 2024 accessible online via their YouTube channel! Now, you can catch up on all the insightful discussions and presentations from the comfort of your home. A particularly engaging story narrated at the event is the talk by Dallas Ramsden, a story of human resilience. The Eclipse Foundation has initiated a collaborative effort to establish common cybersecurity standards in response to the upcoming European Union's Cyber Resilience Act. This initiative involves multiple open-source organizations and aims to harmonize secure software development practices across the industry, addressing both regulatory requirements and the broader challenge of securing open-source software. The Greek Drupal Community celebrated a resurgence with the Greece Spring Sprint 2024, where experienced developers across Athens, Thessaloniki, and Patras collaborated to address numerous issues. We have received pictures via Georgios Andreadis of the event, take a look here.

Jesus Manuel Olivas, Co-Founder and CEO at Octahedroid, announced the initial release of two significant Drupal modules—Visual Editor and Decoupled Preview Iframe. A recent update from Drupal.org saw Gábor Hojtsy outlining the forthcoming release plans for Drupal 11, noting significant dependency updates and two potential release windows later this year. Obviously, this has created discussions in the community. Paul Johnson, a long-time participant and photographer at Drupal events, has announced an initiative by the Promote Drupal team to create the first official Promote Drupal Image Library. The team calls for submissions from photographers within the Drupal community who are willing to contribute their work under a Creative Commons license. 

While there are undoubtedly more stories to share, our current constraints may necessitate a temporary pause in our coverage.

To get timely updates, follow us on LinkedIn, Twitter and Facebook. Also, join us on Drupal Slack at #thedroptimes.

Thank you,
Sincerely
Kazima Abbas
Sub-editor, The Drop Times

Kategorien: Drupal News

Talking Drupal: Talking Drupal #446 - Test Driven Development

Mo, 04/15/2024 - 20:00

Today we are talking about Test Driven Development, Why it’s important, and How it improves development with guest Alexey Korepov. We’ll also cover Test Helpers as our module of the week.

For show notes visit: www.talkingDrupal.com/446

Topics
  • What does the term Test Driven Development (TDD) mean
  • Does Drupal make use of TDD
  • What makes TDD different from other methods of Development
  • Do you have to change your way of thinking
  • What are some good resources to learn TDD
  • Do you have any pointers for teams looking to get started
  • Are certain kinds of projects better suited to TDD
  • How have dev teams adapted to TDD
  • Any advice on environment setup
  • Any special tools
Resources Guests

Alexey Korepov - korepov.pro Murz

Hosts

Nic Laflin - nLighteneddevelopment.com nicxvan Martin Anderson-Clutz - mandclu Matt Glaman - mglaman.dev mglaman

MOTW Correspondent

Martin Anderson-Clutz - mandclu

  • Brief description:
    • Have you ever wanted an API that could dramatically simplify the process of writing Drupal unit tests? There’s a module for that.
  • Module name/project name:
  • Brief history
    • How old: created in Sep 2022 by today’s guest, Alexey Korepov
    • Versions available: 1.3.0 compatible with versions of Drupal 9.4 or newer, right up to Drupal 11
  • Maintainership
    • Actively maintained, latest release less than 3 months ago
    • Security coverage
    • Test coverage, would be ironic if it didn’t
    • API Documentation is available, linked from the project page
    • Number of open issues: 2 open issues, which are actually feature requests
  • Usage stats:
    • 5 sites officially, but modules or sites can leverage Test Helpers without enabling it, and this usage is recommended, so the number is actually higher
  • Module features and usage
    • Provides a new container that automated tests can leverage to perform common tasks with much less code.
    • For example, you can create a user or a node with a single line of code
    • You can also mock more complex operations like an entityQuery or loadMultiple call, again with a single line of code
    • Traditionally, writing unit tests is more complicated because by design they run without fully bootstrapping Drupal
    • That means that your test needs to mock functions or services in the code you’re testing which can result in units tests being much longer than the code they’re testing
    • Test Helpers also allows your tests to leverage existing mocks and stubs for popular services
    • The project page also links to the recording and slides for a talk Alexey gave about Test Helpers at DrupalCon Pittsburgh last year, if you want to do a deeper dive
Kategorien: Drupal News

The Drop Times: Customer Benefits from Pantheon—Lytics Partnership Explained

Mo, 04/15/2024 - 19:19
Pantheon and Lytics have teamed up to redefine the landscape of website personalization, introducing a solution announced at the Google Cloud Next ‘24 conference. This collaboration offers a transformative approach by leveraging generative AI to provide sophisticated personalization tools, which were previously complex and expensive but are now streamlined and accessible.

By integrating Lytics' Personalization Engine, companies can deploy tailored digital content strategies within 30 days—significantly faster than the traditional months-long process. This partnership simplifies the personalization process and emphasizes using first-party data, aligning with privacy standards, and moving away from reliance on third-party cookies. Embrace this new digital marketing era with Pantheon and Lytics, where advanced technology meets user-centric privacy.
Kategorien: Drupal News

#! code: Drupal 10: Adding Extra User Account Protection

So, 04/14/2024 - 20:01

One of Drupal's strengths is its ability to create communities of users who contribute towards the content of the site. Whether you have an open forum, where users can create their own accounts, or a closed magazine site with just a few editors, you need to take the security of your users seriously.

Out of the box, Drupal has a number of account protection features that assist in making sure that users are authenticated correctly.

For example, the user login page is protected by a brute force system and will lock accounts after a number of incorrect password attempts in a short amount of time.

There are a few other things you can do to protect your site users that can be applied to any Drupal site. In this article we'll look through a number of different modules and techniques you can use to protect the user accounts on your site. We'll look at some of the pros and cons of each approach.

Flood Control

Drupal's login forms have built in brute force projection that will block any user account that fails to enter the correct password more than 5 times per IP address within an hour. This prevents automated bots from just guessing the password of a user account thousands of times until it hits the right combination.

The Flood Control module allows these settings to be tweaked to make them more (or less) restrictive.

Read more

Kategorien: Drupal News

Mario Hernandez: Building a modern Drupal theme with Storybook

So, 04/14/2024 - 02:00

Building a custom Drupal theme nowadays is a more complex process than it used to be. Most themes require some kind of build tool such as Gulp, Grunt, Webpack or others to automate many of the repeatitive tasks we perform when working on the front-end. Tasks like compiling and minifying code, compressing images, linting code, and many more. As Atomic Web Design became a thing, things got more complicated because now if you are building components you need a styleguide or Design System to showcase and maintain those components. One of those design systems for me has been Patternlab. I started using Patternlab in all my Drupal projects almost ten years ago with great success. In addition, Patternlab has been the design system of choice at my place of work but one of my immediate tasks was to work on migrating to a different design system. We have a small team but were very excited about the challenge of finding and using a more modern and robust design system for our large multi-site Drupal environment.

Disclaimer: Due to technical restrictions and project requirements, we were not able to use Single Directory Components or SDC, nor the Storybook module. Our front-end environment was custom built from the ground up.

Enter Storybook

After looking a various options for a design system, Storybook seemed to be the right choice for us for a couple of reasons: one, it has been around for about 10 years and during this time it has matured significantly, and two, it has become a very popular option in the Drupal ecosystem. In some ways, Storybook follows the same model as Drupal, it has a pretty active community and a very healthy ecosystem of plugins to extend its core functionality.

Storybook looks very promising as a design system for Drupal projects and with the recent release of Single Directory Components or SDC, and the new Storybook module, we think things can only get better for Drupal front-end development. Unfortunately for us, technical limitations in combination with our specific requirements, prevented us from using SDC or the Storybook module. Instead, we built our environment from scratch with a stand-alone integration of Storybook 8.

Our process and requirements

In choosing Storybook, we went through a rigorous research and testing process to ensure it will not only solve our immediate problems with our current environment, but it will be around as a long term solution. As part of this process, we also tested several available options like Emulsify and Gesso which would be great options for anyone looking for a ready-to-go system out of the box. Some of our requirements included:

1. No components refactoring

The first and non-negotiable requirement was to be able to migrate components from Patternlab to a new design system with the least amount of refactoring as possible. We have a decent amount of components which have been built within the last year and the last thing we wanted was to have to rebuild them again because we are switching design system.

2. A new Front-end build workflow

I personally have been faithful to Gulp as a front-end build tool for as long as I can remember because it did everything I needed done in a very efficient manner. The Drupal project we maintain also used Gulp, but as part of this migration, we wanted to see what other options were out there that could improve our workflow. The obvious choice seemed to be Webpack, but as we looked closer into this we learned about ViteJS, "The Next Genration Frontend Tooling". Vite delivers on its promise of being "blazing fast", and its ecosystem is great and growing, so we went with it.

3. No more Sass in favor of PostCSS

CSS has drastically improved in recent years. It is now possible with plain CSS, to do many of the things you used to be able to only do with Sass or similar CSS Preprocessor. Eliminating Sass from our workflow meant we would also be able to get rid of many other node dependencies related to Sass. The goal for this project was to use plain CSS in combination with PostCSS and one bonus of using Vite is that Vite offers PostCSS processing out of the box without additional plugins or dependencies. Ofcourse if you want to do more advance PostCSS processing you will probably need some external dependencies.

Building a new Drupal theme with Storybook

Let's go over the steps to building the base of your new Drupal theme with ViteJS and Storybook. This will be at a high-level to callout only the most important and Drupal-related parts. This process will create a brand new theme. If you already have a theme you would like to use, make the appropriate changes to the instructions.

1. Setup Storybook with ViteJS ViteJS
  • In your Drupal project, navigate to the theme's directory (i.e. /web/themes/custom/)
  • Run the following command:
npm create vite@latest my_theme # replace my_theme with a name of your choice.
  • When prompted, select the framework of your choice, for us the framework is React.
  • When prompted, select the variant for your project, for us this is JavaScript

After the setup finishes you will have a basic Vite project running.

Storybook
  • Be sure your system is running NodeJS version 18 or higher
  • Inside the newly created theme, run this command:
npx storybook@latest init --type react
  • After installation completes, you will have a new Storybook instance running
  • If Storybook didn't start on its own, start it by running:
npm run storybook TwigJS

Twig templates are server-side templates which are normally rendered with TwigPHP to HTML by Drupal, but Storybook is a JS tool. TwigJS is the JS-equivalent of TwigPHP so that Storybook understands Twig. Let's install all dependencies needed for Storybook to work with Twig.

  • If Storybook is still running, press Ctrl + C to stop it
  • Then run the following command:
npm i -D vite-plugin-twig-drupal html-react-parser twig-drupal-filters @modyfi/vite-plugin-yaml
  • vite-plugin-twig-drupal: If you are using Vite like we are, this is a Vite plugin that handles transforming twig files into a Javascript function that can be used with Storybook. This plugin includes the following:
    • Twig or TwigJS: This is the JavaScript implementation of the Twig PHP templating language. This allows Storybook to understand Twig.
      Note: TwigJS may not always be in sync with the version of Twig PHP in Drupal and you may run into issues when using certain Twig functions or filters, however, we are adding other extensions that may help with the incompatability issues.
    • drupal attribute: Adds the ability to work with Drupal attributes.
  • twig-drupal-filters: TwigJS implementation of Twig functions and filters.
  • html-react-parser: This extension is key for Storybook to parse HTML code into react elements.
  • @modifi/vite-plugin-yaml: Transforms a YAML file into a JS object. This is useful for passing the component's data to React as args.
ViteJS configuration

Update your vite.config.js so it makes use of the new extensions we just installed as well as configuring the namesapces for our components.

import { defineConfig } from "vite" import yml from '@modyfi/vite-plugin-yaml'; import twig from 'vite-plugin-twig-drupal'; import { join } from "node:path" export default defineConfig({ plugins: [ twig({ namespaces: { components: join(__dirname, "./src/components"), // Other namespaces maybe be added. }, }), // Allows Storybook to read data from YAML files. yml(), ], }) Storybook configuration

Out of the box, Storybook comes with main.js and preview.js inside the .storybook directory. These two files is where a lot of Storybook's configuration is done. We are going to define the location of our components, same location as we did in vite.config.js above (we'll create this directory shortly). We are also going to do a quick config inside preview.js for handling drupal filters.

  • Inside .storybook/main.js file, update the stories array as follows:
stories: [ "../src/components/**/*.mdx", "../src/components/**/*.stories.@(js|jsx|mjs|ts|tsx)", ],
  • Inside .storybook/preview.js, update it as follows:
/** @type { import('@storybook/react').Preview } */ import Twig from 'twig'; import drupalFilters from 'twig-drupal-filters'; function setupFilters(twig) { twig.cache(); drupalFilters(twig); return twig; } setupFilters(Twig); const preview = { parameters: { controls: { matchers: { color: /(background|color)$/i, date: /Date$/i, }, }, }, }; export default preview; Creating the components directory
  • If Storybook is still running, press Ctrl + C to stop it
  • Inside the src directory, create the components directory. Alternatively, you could rename the existing stories directory to components.
Creating your first component

With the current system in place we can start building components. We'll start with a very simple component to try things out first.

  • Inside src/components, create a new directory called title
  • Inside the title directory, create the following files: title.yml and title.twig
Writing the code
  • Inside title.yml, add the following:
--- level: 2 modifier: 'title' text: 'Welcome to your new Drupal theme with Storybook!' url: 'https://mariohernandez.io'
  • Inside title.twig, add the following:
<h{{ level|default(2) }}{% if modifier %} class="{{ modifier }}"{% endif %}> {% if url %} <a href="{{ url }}">{{ text }}</a> {% else %} <span>{{ text }}</span> {% endif %} </h{{ level|default(2) }}>

We have a simple title component that will print a title of anything you want. The level key allows us to change the heading level of the title (i.e. h1, h2, h3, etc.), and the modifier key allows us to pass a modifier class to the component, and the url will be helpful when our title needs to be a link to another page or component.

Currently the title component is not available in storybook. Storybook uses a special file to display each component as a story, the file name is component-name.stories.jsx.

  • Inside title create a file called title.stories.jsx
  • Inside the stories file, add the following:
/** * First we import the `html-react-parser` extension to be able to * parse HTML into react. */ import parse from 'html-react-parser'; /** * Next we import the component's markup and logic (twig), data schema (yml), * as well as any styles or JS the component may use. */ import title from './title.twig'; import data from './title.yml'; /** * Next we define a default configuration for the component to use. * These settings will be inherited by all stories of the component, * shall the component have multiple variations. * `component` is an arbitrary name assigned to the default configuration. * `title` determines the location and name of the story in Storybook's sidebar. * `render` uses the parser extension to render the component's html to react. * `args` uses the variables defined in title.yml as react arguments. */ const component = { title: 'Components/Title', render: (args) => parse(title(args)), args: { ...data }, }; /** * Export the Title and render it in Storybook as a Story. * The `name` key allows you to assign a name to each story of the component. * For example: `Title`, `Title dark`, `Title light`, etc. */ export const TitleElement = { name: 'Title', }; /** * Finally export the default object, `component`. Storybook/React requires this step. */ export default component;
  • If Storybook is running you should see the title story. See example below:
  • Otherwise start Storybook by running:
npm run storybook

With Storybook running, the title component should look like the image below:


The controls highlighted at the bottom of the title allow you to change the values of each of the fields for the title.

I wanted to start with the simplest of components, the title, to show how Storybook, with help from the extensions we installed, understands Twig. The good news is that the same approach we took with the title component works on even more complex components. Even the React code we wrote does not change much on large components.

In the next blog post, we will build more components that nest smaller components, and we will also add Drupal related parts and configuration to our theme so we can begin using the theme in a Drupal site. Finally, we will integrate the components we built in Storybook with Drupal so our content can be rendered using the component we're building. Stay tuned. For now, if you want to grab a copy of all the code in this post, you can do so below.

Download the code

Resources In closing

Getting to this point was a team effort and I'd like to thank Chaz Chumley, a Senior Software Engineer, who did a lot of the configuration discussed in this post. In addition, I am thankful to the Emulsify and Gesso teams for letting us pick their brains during our research. Their help was critical in this process.

I hope this was helpful and if there is anything I can help you with in your journey of a Storybook-friendly Drupal theme, feel free to reach out.

Kategorien: Drupal News

Dropsolid Experience Agency: Ready for **Drupal 10**?

Sa, 04/13/2024 - 20:24
December 14 is the release of Drupal 10. By switching to Drupal Core Release Cycle, the impact of the upgrade is not huge. Be prepared anyhow!
Kategorien: Drupal News

Dropsolid Experience Agency: Why Drupal is a Shark

Sa, 04/13/2024 - 20:24
Drupal has been able to adapt and stay the top choice for open enterprise CMS, especially as the key component in the modern digital experience platform (DXP).
Kategorien: Drupal News

Dropsolid Experience Agency: How to create a DXP (Digital Experience Platform) with Drupal

Sa, 04/13/2024 - 20:24
Are your customers asking for a DXP instead of a CMS? Are your developers struggling to build personalized digital experiences wit
Kategorien: Drupal News

Dropsolid Experience Agency: Contributing to Open Source, what's your math?

Sa, 04/13/2024 - 20:24
1xINTERNET made a great post about calculating how much yo
Kategorien: Drupal News

Dropsolid Experience Agency: ngrok: testing payment gateways in Drupal commerce

Sa, 04/13/2024 - 20:24
Building commerce websites always means building integrations.
Kategorien: Drupal News

Dropsolid Experience Agency: Online payments in Drupal

Sa, 04/13/2024 - 20:24
In this day and age, it’s very hard to imagine a world without online payments.
Kategorien: Drupal News

Gábor Hojtsy: Supporting Drupal transitions at DrupalCon Portland 2024

Fr, 04/12/2024 - 12:07
Supporting Drupal transitions at DrupalCon Portland 2024

DrupalCon Portland 2024 is coming up next month! The event provides good opportunities to get help with three major transitions of Drupal in 2024. Drupal 7's end of life is near, while Drupal 11 is released this year. Finally, DrupalCI testing is superceeded by much improved GitLab CI pipelines shortly after DrupalCon. Here are some highlights of related events to not miss at DrupalCon!

Gábor Hojtsy Fri, 04/12/2024 - 13:07
Kategorien: Drupal News

LN Webworks: How To Create Hooks Vs Event Subscribers in Drupal 9

Fr, 04/12/2024 - 08:45

In Drupal development, understanding the differences between hooks and event subscribers is essential for building robust and flexible modules. Hooks are a fundamental part of Drupal's architecture, allowing modules to interact with and modify various aspects of the system's behavior. Moreover, event subscribers are a more recent addition to Drupal, introduced in Drupal 8 as part of its transition to a more modern, object-oriented architecture.

Hooks in Drupal

Hooks are specially named functions that a module defines and calls at specific times to alter, add, or modify the data.

Kategorien: Drupal News

The Drop Times: Harmony in Code: Irina Zaks' Open Source Journey

Do, 04/11/2024 - 21:39
In a compelling interview, Irina Zaks, co-founder and CTO of Fibonacci Web Studio, shares insights on bridging quantum physics with web development, simplifying Drupal migrations, and advocating for open source in academia. Ahead of her Stanford WebCamp 2024 session, Irina discusses the impact of her work on the academic sector and her vision for the future of web technology.
Kategorien: Drupal News

The Drop Times: Greece Spring Sprint 2024: Revitalizing the Greek Drupal Community

Do, 04/11/2024 - 21:39
Witness the vibrant resurgence of the Greek Drupal Community at the Greece Spring Sprint 2024, where collaboration, camaraderie, and innovation reign supreme.
Kategorien: Drupal News