Talking Drupal: Skills Upgrade #3

Welcome back to “Skills Upgrade” a Talking Drupal mini-series following the journey of a D7 developer learning D10. This is episode 3.

Topics
  • Review Chad's goals for the previous week

    • DDEV performance improvements
    • Install Drupal 10
    • Install drupal/core-dev
    • Configure and test phpcs
    • Test phpstan
    • settings.local.php
    • Install Devel module
  • Review Chad's questions

    • Rancher Desktop appears to be holding on to port 443 after I installed it. Although I changed the port to something else, do you have any suggestions to update the setup to use ports 443 and 80 instead?
    • How are tools like phpcs and PHPStan used by the Drupal community for contrib? Are they a part of drupal.org's testing automation?
    • Starting a new D10 website from scratch in DDEV is one thing … How would I typically work with an existing D10 website? Do I start with the community config, then overwrite the code, database, and files? Is there a better approach?
  • Tasks for the upcoming week

/vendor /web/core /web/modules/contrib/ /web/themes/contrib/ /web/profiles/contrib/ /web/libraries/ *.sql.gz Resources

Chad's Drupal 10 Learning Curriclum & Journal Chad's Drupal 10 Learning Notes

The Linux Foundation is offering a discount of 30% off e-learning courses, certifications and bundles with the code, all uppercase DRUPAL24 and that is good until June 5th https://training.linuxfoundation.org/certification-catalog/

Hosts

AmyJune Hineline - @volkswagenchick

Guests

Chad Hester - chadkhester.com @chadkhest Mike Anello - DrupalEasy.com @ultimike

   

Evolving Web: 9 Ways to Make the Most of the EvolveDrupal Summit

Image removed.

Hi there! I’m Jasmin Merchant, a Front-End Developer at Evolving Web. A few years ago I knew very little about the open web. That all changed when I started working here and was plunged into ongoing learning opportunities.

The EvolveDrupal Ottawa summit in 2023 was a big part of my learning curve. Hosted by Evolving Web, the event was a chance to gain new knowledge about development, accessibility, UX, digital strategy, and many other relevant topics.

What’s more, it was a great introduction to networking. This was my first tech summit and I had only moved to Canada one week before, so I was nervous to say the least. But EvolveDrupal was a valuable experience that really built my confidence.

I’ve shared my takeaways in this article to help others who are planning to attend EvolveDrupal (or any tech event). Use these 9 tips to attend with confidence and make the most of it!

Before the Summit

1. Create your own schedule

My day at EvolveDrupal Ottawa started with coffee (because obviously!). I hung out in the foyer where I could chat to people as they arrived. I was looking forward to talks on Drupal, design, AI, and much more. Crucially, I had gone through the session list earlier and planned out my day.

Having your own schedule means you can pace yourself, attend the talks you're most interested in, and maximize your networking opportunities. Remember that EvolveDrupal has a wide range of sessions and many of them run in parallel, so it isn’t possible to attend all of them.

I’d recommend making space in your schedule for a bit of down time to recharge. I found this was easy to do at EvolveDrupal—the event was very well organized with little breaks between sessions, helping me to relax and go with the flow.

Image removed.
 

2. Sign up for pre-summit introductions

Evolving Web often organizes a pre-summit dinner the night before EvolveDrupal. As an introvert, I found this was a great way to ease into networking. I got to meet some really interesting, talented people and talk to them on a personal level over a nice meal. It meant that I saw some familiar faces in the crowd full of attendees the next day.

Can’t attend the pre-summit dinner? Don’t worry, you can connect digitally with organizers, speakers and participants before the summit instead. If you’ve registered for the summit, you’ll be invited to the EvolveDrupal Slack channel. 

3. Build your visibility

Post on social media to tell your connections that you’ll be at EvolveDrupal. This can help you connect with more people at the event. Remember to tag Evolving Web on LinkedIn so we can help boost your post!

Email specific contacts and invite them to the summit, too. This can be a great way to grow and strengthen existing business relationships.

Want to maximize your visibility? Apply to be a speaker or sponsor. It’s a fantastic way to get in front of an audience—both in-person at the summit and also in Evolving Web’s digital communications.

 

“I had a blast yesterday talking at the EvolveDrupal conference in Ottawa. Thank you for giving me the opportunity. Based on the number of people in the audience that raised their phone to take pictures of the slides, I guess the content was on point!”

– Gauthier Garnier, Platform.sh (EvolveDrupal Ottawa 2023)

During the Summit 

4. Make notes

At each session I attended at EvolveDrupal, I took notes about everything interesting and important that I was learning. Have a think about how you prefer to take notes—can you do it on your phone, or should you bring a tablet or notebook?

It’s best to jot down new knowledge and ideas at the event itself, before you forget. That said, some EvolveDrupal sessions are recorded and published a few weeks later, so you may have a chance to rewatch select talks. 

5. Embrace a bit of discomfort

While the pre-summit dinner put me at greater ease, I was still nervous about networking. But I learned that it’s ok to be outside of my comfort zone. As one of the speakers said: “get comfortable being uncomfortable.” Their talk was on AI, but I think the concept can be applied to a lot more!

I started by introducing myself to people I sat near during the sessions. This felt easier as there was already a clear topic to start the conversation. I met many more people at lunch and kept taking mental notes that I wrote down later. If there’s someone you want to follow up with, ask for their business card or record their name so you can add them on LinkedIn.

It’s also worth engaging with the speakers who interest you. As experts they can offer valuable information, and they’re usually more than happy to expand on their talk if you ask questions.

Image removed.
 

6. Stick around for evening events

EvolveDrupal Ottawa finished with a networking reception, but my day didn’t end there! I attended a post-summit dinner and drinks with people who wanted to continue connecting. As it was the end of the night, everyone was relaxed and chatting easily. It was a good chance to speak again with the people I’d met that day and get to know them better. Evolving Web often arranges a post-summit dinner, so leave your evening open if you can. 

After the Summit

7. Follow up with your connections 

I added most of the people I met at EvolveDrupal Ottawa on LinkedIn. It’s an easy way to stay connected because you can respond to their posts or share useful things with them. It’s also a good idea to send a personalized message to new contacts who you want to develop a deeper relationship with, such as business prospects and potential employers. Ask for a phone call or face-to-face meeting to discuss opportunities. 

8. Organize and apply what you learned 

Write up your notes soon after the summit. If you leave it too long, you may forget them or find they don’t make sense any more! Also, decide how you’re going to integrate your new knowledge into your workflows and projects. Act quickly while you’re still feeling energized from the event.

 

“It was a treasure trove of UX wisdom… Big thanks to the amazing speakers and organizers for making this experience unforgettable. Can't wait to apply what I've learned. Count me in for the next one!”

– Milan Nayak, UX Designer (EvolveDrupal Toronto 2023) 

9. Share your insights and experience 

My time at EvolveDrupal was eye-opening, so I wanted to share my experience in an article to help future participants. You can also share takeaways via an email, team meeting, or internal presentation. Finally, it’s always nice to thank the speakers on social media and tell them what you liked about their session.

I hope this article inspires you to attend EvolveDrupal with confidence and purpose. Sign up for updates to hear about upcoming events. Our next stops are in Atlanta (April 12) and Montreal (June 14)—we look forward to seeing you there!

+ more awesome articles by Evolving Web

Drupal.org blog: What's next for (Drupal) innovation

Last year the Drupal Association brought me onto the team using a special board vision fund to help kick off our first steps in increasing our focus on innovation.

This phase is coming to an end in May with the end of my contract, and right in time for Drupalcon Portland. I am incredible grateful for this past months, for all the people and friends I've met inside and outside of the Drupal Association, for all the work we've done together, and for all the work that is still to come.

But before I wrap up my work with the team I want to report on the progress we've made so far, what we're still working on until May, and what happens next.

Alex took on a herculean task when he joined us for this special engagement to help determine our strategy for accelerating innovation in Drupal. I'm extremely grateful for what he's accomplished and proud to have had him join our team.

Thanks to his work we've fostered 6 fantastic projects through Pitchburgh grant funding, completed a study of friction points in our new user registration, onboarding and contribution process, identified an action plan to better onboard new contributors, improve open source contribution and set our sights on even higher goals.

I'd love to see Drupal step forward to help us take the next step!

Tim Lehnen CTO
Drupal Association

Lots of work to be proud of

Innovation Working Group

The Innovation working group is a gathering happening every other week, in  which we report progress on ongoing initiatives as well as discuss everything related to innovation, from contributor guidance, to documentation. As part of my role I took the leadership of the working group, and steered the direction of the discussions as well as the topics to be discussed.

Some of the initiatives that started as a seed from that group are the research on the documentation improvements (spearheaded by Mike Herschel), the onboarding analysis (executed by myself), the Drupal Acceleration team proposal (led by Laurii and Cristina Chumillas), a conversation about the relative value of a credit to the contributor wage invested, and many more.

As a personal note, I have to thank the whole group for their passion and commitment to improving Drupal, and especially for their patience with me while I was trying to find my place in this new world that I joined in 2023.

Pitchburgh

Pitchburgh was kick-started by Dries during Drupalcon Pittsburgh 2023, and consists of an innovation contest in which participants would propose their innovative ideas for Drupal, and a mix between judges and people at Drupalcon itself would vote the winners.

Acting as the program manager / coordinator of the 6 projects, my role helped on a diverse range of tasks, sometimes outside of my own zone of comfort, like getting contracts ready for sign up, syncing with core committers when needed, communications and relations with the community and a broad range of other tasks.

We're proud to be sharing the success stories of each of these projects at DrupalCon Portland in May.

Contribution Health Dashboards

As part of the feedback from the Innovation Working Group we took care of creating a series of dashboards and Drush scripts with the goal of getting a better understanding of the contribution ecosystem in Drupal, finding what needs improvement and how any changes introduced in the ecosystem would impact the platform.

From these dashboards we can track the impact of our work to improve contributor onboarding.

Onboarding new users/contributors

The first contact a big portion of our users have with Drupal is our drupal.org registration. Improving that process not only ensures that we are delivering the image and branding that Drupal deserves, but also we maximize the opportunities to convert those users from takers to makers. The start of 2024 was full of research and investigation on the outdated registration flow, a set of recommendations have been put in place, and changes have already started, including a more prominent presence of guidance and help for new want-to-be contributors.

We'll be implementing a new 'persona' field to help us categorize new users and set them on the appropriate journey for their role.

Contribution friction analysis

When a hindrance obstructs innovation, it often persists for months or even years. The extended duration of the contribution pipeline presents an opportunity to reduce this time to contribution, enhance the velocity of Open Source projects, in this case Drupal, and accelerate Drupal's development process.

During different times we went through the contribution process in Drupal, aiming to identify friction points and other blockers, while I also kept conversations with different members of the community, contributors and core members. I expect to publish this research and my findings and recommendations prior to Drupalcon Portland, and I hope that this will provide valuable insights into the factors impeding contribution and suggesting strategies to optimize efforts.

For more information, join my session, co-presented with Irina Zaks (who has also been researching on this topic) at DrupalCon portland, titled: Innovation and contribution challenges

Bounty program

The Bounty program was a pilot program with the idea to research possible solutions to a few common problems, the most important one, ensure contributions happen where Drupal and the Drupal Association needs them more, which is, for example (but not only), strategic initiatives and innovation projects.

The program was successful as it resuscitated some old, sleeping issues, and even solved one of them (which was open for more than 4 years) in just a few weeks. The program demonstrated the need of soft steering in the right direction, and a phase 2 has already been started with the aim to make an ever wider impact.

Read about the Bounty program here, and the Bounty program extension here.

Contributor (priorities) guide

The Bounty program, together with conversations we’ve been having with companies and partners, also inspired us to create a contributor guide which helps companies and individuals to steer everyone on the right path towards contributions that are more meaningful and have higher impact in the community.

You can read the priority guide contributor announcement here: Maximizing contributions

Innovation landing

One of the realizations during this time collaborating with the Innovation Working Group is that innovation will not come from specific individuals or even necessarily from a group. 

Drupal is a highly decentralized community, and innovation will come from that community. We have a huge amount of modules, which is one of our biggest strengths. But that as well means that we need to ensure that we keep our conversations and meetings diverse enough. The community needs to surface those projects that are innovative.

The next big leap is probably hidden, deep in a sea of ideas and projects. Hence, the only way to ensure that we don’t miss the next wave is to ensure that everyone has a voice.

That’s why we agreed early to create an innovation landing page, which could capture the essence of Drupal Innovation, serve as a center of information, and inspire others to do more of the great things that we are used to seeing in our community.
 

More for us to do!

Drupal has always been a do-ocracy- where passionate, motivated contributors with a great idea can roll up their sleeves and get things done. The work above represents some great first steps (and it's hard to believe how fast time flew by!) but as a community we have to come together with a collective commitment to do more.

Innovation does not stop here, my work was just the beginning, setting up the base of what’s next. The Drupal association needs your help, so moving forward we could:

  • Creating a dedicated innovation fund that partner organizations and individuals can contribute to, to make specific, targeted investments in innovation
  • Grant Fundraising and Sponsorship for dedicated roles within the Drupal Association
    • For example - partners could come together to 'endow' a position for a role like mine of Innovation Program manager to be made permanent.
    • And/Or for roles like a Contribution Success Manager
    • And/Or for direct core contribution engineers

Only together will we be able to scale the pace of innovation in Drupal - and we have so many capable people in our community that our biggest barrier is only finding the resources to make our vision a reality. That is something we can solve together.

On a personal note, while my engagement is coming to a close, this is not a goodbye. I'm more committed than ever to the Drupal community and excited about its future. If you want to support our continued efforts to work with the Drupal Association on these goals, please let us know: alex@association.drupal.org

The Drop Times: Catch Up with the Drupal Community at DrupalSouth Sydney 2024!

Discover the highlights and insider views of DrupalSouth Sydney 2024, from key tech updates to diversity initiatives. Learn what makes this event a key spot for developers and digital enthusiasts, along with exclusive insights from the community's leading voices. Get a sneak peek into the enriching sessions, networking opportunities, and cultural experiences waiting in Sydney.

Specbee: Hooks or Events? Choosing the Best Approach for your Drupal Project

For Drupal developers, it's crucial to understand two fundamental concepts: Events and Hooks. Why? Because they’re the most powerful ways to enable customization and extensibility in Drupal. An event is a system or module-generated occurrence that triggers specific actions, while a hook is a callback function that allows developers to interact with, modify, or extend the behavior of a Drupal core or any module. Ready to learn more about each of them and find out how they’re different in their roles and usage in Drupal development? Dive in! What are Events in Drupal Events are just like hooks that tell Drupal to call your function if something happens. We can say Events are Object Oriented Hook System. Drupal Events allow various system components to interact and communicate with one another independently or in a decoupled manner. Characteristics Events are part of Drupal's broader adoption of the Symfony framework. Events are dispatched by certain actions or triggers within the system. You can dispatch events while writing custom code in order to notify other components in the system about actions taken by your code. Developers can subscribe to these events and define custom actions to be executed when the event occurs. Example Drupal core event: KernelEvents::REQUEST Scenario: Implementing a custom module that listens to the REQUEST event to perform specific actions before the request is processed. // MyModuleEventSubscriber.php namespace Drupal\my_module\EventSubscriber; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\RequestEvent; class MyModuleEventSubscriber implements EventSubscriberInterface {   public static function getSubscribedEvents() {     $events[KernelEvents::REQUEST][] = ['onRequestEvent'];     return $events;   }   public function onRequestEvent(RequestEvent $event) {     // Custom logic to be executed on every request.   } }Discover Existing Events There are different methods for finding existing events: 1. Using the WebProfiler module: Download and enable WebProfiler and Devel module since WebProfiler depends on the Devel module Then navigate to Manage > Configuration > Devel Settings > WebProfiler and then select the checkbox to activate the “Events” toolbar item. Now while you visit any page on your site you should see the WebProfiler toolbar at the bottom of the page, and after clicking on the events toolbar icon you will get a list of all event subscribers and information that are called during that request. 2. Use Devel to view and event class: drush devel:event  Enter the number for which you want to get information.:   [0] kernel.controller   [1] kernel.exception   [2] kernel.request   [3] kernel.response   [4] kernel.terminate   [5] kernel.view  > 0  Enter the number to view the implementation.:   [0] Drupal\path_alias\EventSubscriber\PathAliasSubscriber::onKernelController   [1] Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::onController   [2] Drupal\webprofiler\DataCollector\RequestDataCollector::onKernelController  > 03. Search in your codebase for @Event:  In your editor such as Visual Studio or PHPStorm, search for text @Event within the file mask: *.php option. Subscribe to an Event As we know Drupal uses an event–driven architecture, where various components can communicate with each other by dispatching and subscribing to Events. Here is an example of subscribing to an Event in Drupal 9/10. 1. Define and Event subscriber service  # MyModule/my_module.services.yml services:   my_module.event_subscriber:     class: Drupal\my_module\EventSubscriber\MyModuleEventSubscriber     tags:       - { name: event_subscriber }2. Define an Event subscriber class // MyModule/src/EventSubscriber/MyModuleEventSubscriber.php namespace Drupal\my_module\EventSubscriber; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\Event; /** * Class MyModuleEventSubscriber. */ class MyModuleEventSubscriber implements EventSubscriberInterface {   /**   * {@inheritdoc}   */   public static function getSubscribedEvents() {     // Specify the event(s) to subscribe to and the method to call when the event occurs.     $events = [       'node.insert' => 'onNodeInsert',       'user.login' => 'onUserLogin',     ];     return $events;   }   /**   * React to a node insert event.   */   public function onNodeInsert(Event $event) {     // Your logic here.     \Drupal::logger('my_module')->notice('Node inserted!');   }   /**   * React to a user login event.   */   public function onUserLogin(Event $event) {     // Your logic here.     \Drupal::logger('my_module')->notice('User logged in!');   } }In this example: MyModuleEventSubscriber is a class that implements the EventSubscriberInterface. The getSubscribedEvents method specifies which events the subscriber is interested in and which method to call when each event occurs. The onNodeInsert and onUserLogin methods contain the logic you want to execute when the corresponding events occur. Dispatch an Event In order to allow another developer to subscribe to the Events and react accordingly, you can dispatch an event within your modules or submodules. Before dispatching an Event we need to understand when to dispatch an event. You can dispatch an event if you want to extend your logic without updating your existing code. Events can be dispatched at any time like creating, updating, loading or deleting data managed by your module. Lets explain this with an example. Take a scenario where we want other developers to interact when a new entity (taking node here) is created after submitting your custom form. 1. Create a custom module (if don’t have): # Create the module directory mkdir modules/custom/custom_logger # Create the module file touch modules/custom/custom_logger/custom_logger.info.yml2. In custom_logger.info.yml, add the following content: name: 'Custom Logger' type: module description: 'Custom module for logging events.' core_version_requirement: ^8 || ^9 || ^10 package: Custom3. Create an Event: // modules/custom/custom_logger/src/Event/CustomLoggerEvent.php namespace Drupal\custom_logger\Event; use Symfony\Component\EventDispatcher\Event; /** * Defines the custom event for the custom_logger module. */ class CustomLoggerEvent extends Event {   /**   * The node that triggered the event.   *   * @var \Drupal\node\Entity\Node   */   protected $node;   /**   * CustomLoggerEvent constructor.   *   * @param \Drupal\node\Entity\Node $node   *   The node that triggered the event.   */   public function __construct($node) {     $this->node = $node;   }   /**   * Get the node object.   *   * @return \Drupal\node\Entity\Node   *   The node.   */   public function getNode() {     return $this->node;   } }4. Dispatch the Event: Creating any entity (taking node here) and dispatching a custom event with a created entity (node) as a parameter. // modules/custom/custom_logger/src/Form/MyCustomForm.php namespace Drupal\custom_logger\Form; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\custom_logger\Event\CustomLoggerEvent; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** * My custom form. */ class MyCustomForm extends FormBase {   /**   * The event dispatcher service.   *   * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface   */   protected $eventDispatcher;   /**   * Constructs a new MyCustomForm object.   *   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher   *   The event dispatcher service.   */   public function __construct(EventDispatcherInterface $event_dispatcher) {     $this->eventDispatcher = $event_dispatcher;   }   /**   * {@inheritdoc}   */   public static function create(ContainerInterface $container) {     return new static(       $container->get('event_dispatcher')     );   }   /**   * {@inheritdoc}   */   public function getFormId() {     return 'my_custom_form';   }   /**   * {@inheritdoc}   */   public function buildForm(array $form, FormStateInterface $form_state) {     // Build your form elements here.     return $form;   }   /**   * {@inheritdoc}   */   public function submitForm(array &$form, FormStateInterface $form_state) {     // Process form submission and create a new node.     // ...     // Dispatch the custom event.     $node = $this->getCreatedNode(); // Implement this method based on your use case.     $event = new CustomLoggerEvent($node);     $this->eventDispatcher->dispatch('custom_logger.event', $event);     // Perform any additional actions after the event is dispatched.   } }5. React to Event: Now other modules or parts of the application can now subscribe to the custom_logger.event with the created node as a parameter. What are Hooks in Drupal Hooks allow modules to alter and extend the existing behavior of Drupal Core or any other module without modifying existing code. Read about update and post update hooks to update your Drupal site in this article. Characteristics Drupal's traditional way of allowing modules to interact with the system. Code can be improved or modified independently and incrementally. Hooks are predefined functions with specific names that Drupal core or modules call at various points during execution. Developers implement these functions in their modules to extend or alter default behavior. Very efficient and easy to implement. Types of Hooks Hooks that react to events: like when the user gets logged in and some action needs to be performed. This is very similar to Events. This is invoked when specific actions are performed. For example hook_user_cancel(). Hooks that answer questions: like “info hooks”. These are invoked when some component is gathering information about a particular topic. These hooks return arrays whose structure and values are determined in the hook definition. For example, see user module hook user_toolbar() that adds links to the common user account page to the Toolbar. Note: In  Drupal 8 or further versions this is generally handled by the plugin system. Therefore there are very few hooks present now than in Drupal 7. Hooks that alter existing data: Alter hooks are generally suffixed with alter. These are invoked to allow modules to alter the existing code. For example: hook_form_alter(). Example: Drupal core hook: hook_form_alter() Scenario: Modifying a form defined by another module. // my_module.module function my_module_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {   // Custom logic to alter the form. }Discover existing Hooks Hooks can be defined by any of contrib or custom modules, even though there are some hooks invoked by Drupal core subsystems like Form API that are always present. This can be a little tricky sometime to find out what hooks are available and which ones to implement. There are different ways to discover existing hooks: Look for the hook definitions in *.api.php files contained either in Drupal core or any contributed modules. You can use your IDE to search for functions whose name starts with hook_. You can get a complete list of hooks here. Another way is to use drush command that will five you a list of all implementations of a specific hook. drush fn-hook help #Alias of drush devel:hookInvoke a New Hook To allow other developers to modify or extends our feature you should invoke a hook or alternatively dispatch an event. This can be done on any action like creating, deleting, updating or event when we receive or push some data through API. Hooks are invoked using the module_handler \Drupal::moduleHandler() services. Hooks can be invoked in different ways: Execute the hook in every module that implements it: ModuleHandler::invokeAll() Execute the hook per-module, usually by looping over a list of enabled modules: ModuleHandler::invoke() Call an alter allowing for alteration of existing data structures using ModuleHandler::alter(). Define a new hook To define a new hook you should do the following: 1. Choose a unique name for your hook 2. Document your hook Hooks are documented in a {MODULE_NAME}.api.php file: // custom_hooks.api.php /** * Define a custom hook for reacting to specific events. * * This hook is invoked when a certain event occurs in the system. * Modules can implement this hook to perform additional actions in response to the event. * * @param string $param1 *   An example parameter for the hook. * @param array $param2 *   Another example parameter for the hook. * * @ingroup custom_hooks_hooks */ function hook_custom_event($param1, array $param2) {   // Your custom hook logic here. }3. Invoking your hook in your module’s code: /** * Implements hook_ENTITY_TYPE_view(). */ function hooks_example_node_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {   // Invoke a hook to alert other modules that the count was updated.   $module_handler = \Drupal::moduleHandler();   // In this example we're invoking hook_custom_event()             $module_handler->invokeAll('custom_event', [$entity]); }When to Use Events or Hooks Events: Prefer events when actions need to be decoupled or when integrating with Symfony components. Hooks: Use hooks for more straightforward modifications or when interacting with the Drupal core and contributed modules. Pros and Cons of using Events VS Hooks Events: Pros: Decoupling, better organization, and Symfony integration. Cons: Slightly steeper learning curve for those unfamiliar with Symfony. Hooks: Pros: Simplicity, well-established in Drupal, easier for Drupal – specific tasks. Cons: Tighter coupling, less organization in larger projects. Final Thoughts Understanding Events and Hooks is extremely crucial for effective Drupal development. While hooks are traditional Drupal mechanisms for extending functionality, events have been introduced since Drupal 8 as part of it’s event-driven architecture. Choosing the right mechanism should be based on the complexity and nature of the Drupal project. Got a Drupal project in mind that requires a 100% Drupal-focused expertise? We’d love to talk to you!

Acquia Developer Portal Blog: DevOps: The Gravity of the Modern Web Cosmos

Image removed.

Some of the illustrations in this article are created by: Martin Anderson-Clutz and Thomas Scola.

🪐Imagine the modern web as an endless universe, a cosmos where websites and applications orbit around users like planets around stars, each vying for attention in the vast expanse of digital space. In this universe, for development teams, DevOps emerges as the force of gravity that holds everything together, an essential principle that ensures these digital worlds don't just float aimlessly but evolve, adapt, and thrive. 

Talking Drupal: Talking Drupal #442 - Mercury Editor

Today we are talking about Mercury Editor, What it does, and how it could change your editorial life with guest Justin Toupin. We’ll also cover Webform Protected Downloads as our module of the week.

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

Topics
  • What is Mercury Editor
  • What is powering Mercury Editor
  • Do you see any risk building on top of Paragraphs
  • Does Mercury Editor cost anything
  • Can companies hire Aten to add features
  • What are some key features
  • What makes Mercury Editor unique
  • How stable is the content
  • What happens if Paragraphs stops being supported
  • How can the community help
Resources Guests

Justin Toupin - atendesigngroup.com justin2pin

Hosts

Nic Laflin - nLighteneddevelopment.com nicxvan John Picozzi - epam.com johnpicozzi Anna Mykhailova - kalamuna.com amykhailova

MOTW Correspondent

Martin Anderson-Clutz - mandclu

  • Brief description:
    • Have you ever wanted to have downloadable content on your website, only available to visitors who have filled out a webform? There’s a module for that.
  • Module name/project name:
  • Brief history
    • How old: created in Sep 2010 by berliner, but the most recent releases are by james.williams of Computer Minds
    • Versions available: 7.x-1.1 and 8.x-1.0-alpha2 versions available, the latter of which works with Drupal 9 and 10
  • Maintainership
    • Actively maintained, the latest release was a week ago
    • Security coverage
    • Introductory blog linked on the project page
    • Number of open issues: 18 open issues, none of which are bugs against the current branch
  • Usage stats:
    • 804 sites
  • Module features and usage
    • Having thought leadership content like white papers or reports gated behind a lead capture form is a common pattern for websites, and this module is designed to make that easy to set up
    • You use the module by adding a handler to your webform, similar to triggering an email send
    • In the configuration for your webform protected download handler you have options for how much verification you want for the download link, whether or not the link should expire after a period of time, and so on, in addition to uploading one or more files that can be downloaded by people who submit the webform
    • The module provides tokens for the download URLs, so you can easily include them in a submission confirmation message or email

The Drop Times: Drupal Page Builders—Part 1: Paragraph-Based Solutions

Dive into the changing dynamics of Drupal's page-building features with André Angelantoni's new series on The DropTimes. Discover the progression of Drupal's page layout options as the author begins exploring Paragraph-Based Solutions. Gain historical insights, learn about the shift towards Layout Builder, and examine the Paragraphs module and related tools like Layout Paragraphs and Mercury Editor. Anticipate detailed discussions on contributed modules, alternative solutions, and potent distributions in the forthcoming parts of the series. Ideal for developers and content managers seeking to upgrade their Drupal 10+ projects.