Skip to content
Menu
Open World News Open World News
  • Privacy Policy
Open World News Open World News

Category: News

ComputerMinds.co.uk: My text filter’s placeholder content disappeared!

Posted on June 19, 2024 by Michael G
ComputerMinds.co.uk: My text filter's placeholder content disappeared!

A story of contributing a fix to Drupal… and a pragmatic workaround

When I upgraded a site from Drupal 10.1 to 10.2, I discovered a particularly serious bug: the login form on our client’s site vanished … which was pretty serious for this site which hid all content behind a login!

We had a custom text format filter plugin to render the login form in place of a custom token in text that editors set, on one of the few pages that anonymous users could access. Forms can have quite different cacheability to the rest of a page, and building them can be a relatively expensive operation anyway, so we used placeholders which Drupal can replace ‘lazily’ outside of regular caching:

class MymoduleLoginFormFilter extends FilterBase implements TrustedCallbackInterface {

  public function process($text, $langcode) {
    $result = new FilterProcessResult($text);
    $needle = '[login_form]';
    // No arguments needed as [login_form] is always to be replaced with the same form.
    $arguments = [];
    $replace = $result->createPlaceholder(self::class . '::renderLoginForm', $arguments);
    return $result->setProcessedText(str_replace($needle, $replace, $text));
  }

  public static function renderLoginForm() {
    // Could be any relatively expensive operation.
    return Drupal::formBuilder()->getForm(UserLoginForm::class);
  }
  
  public static function trustedCallbacks() {
    return ['renderLoginForm'];
  }

}

But our text format also had core’s “Correct faulty and chopped off HTML” filter enabled – which completely removed the placeholder, and therefore the form went missing from the final output!

Debugging this to investigate was interesting – it took me down the rabbit hole of learning more about PHP 8 Fibers, as Drupal 10.2 uses them to replace placeholders. Initially, I thought the problem could be there, but it turned out that the placeholder itself was the problem. Drupal happily generated the form to go in the right place, but couldn’t find the placeholder. Here’s what a placeholder, created by FilterProcessResult::createPlaceholder() should look like:

<drupal-filter-placeholder callback="DrupalmymodulePluginFilterMymoduleLoginFormFilter::renderLoginForm" arguments="" token="hqdY2kfgWm35IxkrraS4AZx6zYgR7YRVmOwvWli80V4"></drupal-filter-placeholder>

Looking very carefully, I spotted that the arguments="" attribute in the actual markup was just arguments – i.e. it had been turned into a ‘boolean’ HTML attribute:

<drupal-filter-placeholder callback="DrupalmymodulePluginFilterMymoduleLoginFormFilter::renderLoginForm" arguments token="hqdY2kfgWm35IxkrraS4AZx6zYgR7YRVmOwvWli80V4"></drupal-filter-placeholder>

There is a limited set of these, and yet the masterminds/html5 component that Drupal 10.2 now uses to process HTML 5 requires an explicit list of the attributes that should not get converted to boolean attributes when they are set to an empty string.

At this point, I should point out that this means a simple solution could be to just pass some arguments so that the attribute isn’t empty! That is a nice immediate workaround that avoids the need for any patch, so is an obvious maintainable solution:

// Insert your favourite argument; any value will do.
$arguments = [42];

At least that ensures our login form shows again!

Login form displayed on homepage as expected

But I don’t see any documentation saying there must be arguments, and it would be easy for someone to write this kind of code again elsewhere, especially if we’re trying to do The Right Thing by using placeholders in filters.

So I decided to contribute a fix back to Drupal core. I’ve worked on core before. Sometimes it’s a joy to find or fix something that affects thousands of people, other times the contribution process can be soul-destroying. At least in this case, I found an existing test in core that could be easily extended to demonstrate the bug. Then I wrote a surgical fix… but I can see that it tightly couples the filter system to Drupal’s HtmlSerializerRules class. That class is within the DrupalComponent namespace, which is described as:

Drupal Components are independent libraries that do not depend on the rest of Drupal in order to function.

Components MAY depend on other Drupal Components or external libraries/packages, but MUST NOT depend on any other Drupal code.

So perhaps it needs configuration in order to be decoupled; and/or a factory service; or maybe modules should subscribe to an event to be able to inject their own rules …. and very quickly perfection feels like the enemy of good, as I can imagine the scope of a solution ballooning in size and complexity. 

I’m all for high standards in core, but fulfilling them to produce solutions can still be a slow and frustrating experience. I’m already involved in enough long-running issues that just bounce around between reviewers, deprecations and changes in standards. I risk just ranting here rather than providing answers – and believe me, I’m incredibly grateful for the work that reviewers and committers have put into producing Drupal – but surely the current process must be putting so many potential contributors off. We worry about attracting talent to the Drupal ecosystem, and turning Takers into Makers, but what are they going to find when they arrive? Contributing improvements of decent size is hard and can require perseverance over years. Where can we adjust the balance to make contribution easier for anyone, even seasoned developers?

As I suggested, perhaps this particular bug needs any of a factory pattern, event subscriber, or injected configuration… but what would my next step be? I’m reluctant to put effort into writing a more complex solution when I know from experience that reviewers might just suggest doing something different anyway. At least I have that simple (if unsatisfying) workaround for the filter placeholder method: always send an argument, even if it might be ignored. I guess that reflects the contribution experience itself sometimes!

`true`, `false` and `nil` in Ruby 💎

Posted on June 19, 2024 by Michael G
You will learn how to easily optimise memory allocation making better use of these 3 objects and why they work this way. https://mathieu-eustachy.com/articles/in-depth-ruby-memory-optimisation-true-false-and-nil

DeepComputing announces third-party RISC-V mainboard for the Framework 13 laptop

Posted on June 19, 2024 by Michael G
Framework, the company making modular, upgradeable, and repairable laptops, and DeepComputing, the same company that’s making the DC ROMA II RISC-V laptop we talked about last week, have announced something incredibly cool: a brand new RISC-V mainboard that fits right into existing Framework 13 laptops. Sporting a RISC-V StarFive JH7110 SoC, this groundbreaking Mainboard was independently designed and developed by DeepComputing. It’s the main component of the very first RISC-V laptop to run Canonical’s Ubuntu Desktop and Server, and the Fedora Desktop OS and represents the first independently developed Mainboard for a Framework Laptop. ↫ The DeepComputing website For a company that was predicted to fail by a popular Apple spokesperson, it seems Framework is doing remarkably well. This new mainboard is the first one not made by Framework itself, and is the clearest validation yet of the concept put into the market by the Framework team. I can’t recall the last time you could buy a laptop powered by one architecture, and then upgrade to an entirely different architecture down the line, just by replacing the mainboard. The news of this RISC-V mainboard has made me dream of other possibilities – like someone crazy enough to design, I don’t know, a POWER10 or POWER11 mainboard? Entirely impossible and unlikely due to heat constraints, but one may dream, right?

Mysterious Seal | Part 4 | Chapter 4 | Devil May Cry: Peak of Combat Game-play ✔

Posted on June 18, 2024 by Michael G
Devil May Cry: Peak of Combat Game-play Part 4 is about Chapter 4 ‘Mysterious Seal’. Dante & Lady goes back to sanctuary to find any lead about Snow. Do you know where she is? 😉

If you like it give it a thumbs up & don’t forget to subscribe
Let others give the chance to also see the video by sharing 🙂

Support me by becoming a patron:
https://www.patreon.com/iamcgbd

Facebook [https://www.facebook.com/iamcgbd]
Instagram [https://www.instagram.com/iamcgbd]
Twitter [https://twitter.com/iamcgbd]
Blogger [https://iamcgbd.blogspot.com]
YouTube [https://www.youtube.com/c/iamcgbd]

Post anything you want me to see at reddit:
https://www.reddit.com/user/iamcgbd

Thanks for watching 🙂

#devilmaycry #devilmaycrypeakofcombat #lady

(Ep63PV) Shrouding the Heavens Ep 63 MULTI-SUB (Zhe Tian)(遮天 )(Den Himmel umhüllen) PREVIEW

Posted on June 18, 2024 by Michael G
Shrouding the Heavens Eng Sub ,Zhe tian Eng Sub ,遮天 Eng Sub ,Shrounding the Heaven Eng Sub ,Shrouding the Heavens 63 Eng Sub ,Zhe tian 63 Eng Sub ,遮天 63 Eng Sub ,Shrounding the Heaven 63Eng Sub ,Shrouding the Heavens Ep 63 Eng Sub ,Zhe tian Ep 63 Eng Sub ,遮天 Ep 63 Eng Sub ,Shrounding the Heaven Ep 63 Eng Sub ,Shrouding the Heavens Episode 63 Eng Sub ,Zhe tian Episode 63 Eng Sub ,遮天 Episode 63 Eng Sub ,Shrounding the Heaven Episode 63 Eng Sub ,

The story took the nine dragons and the coffin as an introduction and brought out a huge world of primeval ages. Climbing the sky road, and singing songs, to see how Ye Fan shrouding the heavens.

#ShroudingtheHeavens #ShroudingtheHeaven #zhetian

Sundalong pinoy, naputulan ng hinlalaki sa banggaan ng barko ng China at Pilipinas sa West PHL…

Posted on June 18, 2024 by Michael G
Hindi lang binangga, kundi kinaladkad at binutas ang bangka ng Pilipinas mga tauhan ng China Coast Guard.

Base ‘yan sa mga kwento ng dalawang source ng GMA Integrated News, kaugnay ng insidenteng ikinasugat ng pitong sundalong pinoy. Ang isa sa kanila — NAPUTULAN PA NG HINLALAKI. Kita ‘yan sa litratong esklusubong nakuha ng GMA Integrated News.

Sabi naman ng China, sumampa pa ang kanilang mga tauhan sa bangka. May mga sinamsam din silang baril at at hinostage na mga bangka ayon sa isang source.

24 Oras is GMA Network’s flagship newscast, anchored by Mel Tiangco, Vicky Morales and Emil Sumangil. It airs on GMA-7 Mondays to Fridays at 6:30 PM (PHL Time) and on weekends at 5:30 PM. For more videos from 24 Oras, visit http://www.gmanews.tv/24oras.

#GMAIntegratedNews #KapusoStream

Breaking news and stories from the Philippines and abroad:
GMA Integrated News Portal: http://www.gmanews.tv
Facebook: http://www.facebook.com/gmanews
TikTok: https://www.tiktok.com/@gmanews
Twitter: http://www.twitter.com/gmanews
Instagram: http://www.instagram.com/gmanews

GMA Network Kapuso programs on GMA Pinoy TV: https://gmapinoytv.com/subscribe

Tech/News/2024/25

Posted on June 18, 2024 by Michael G
Latest tech news from the Wikimedia technical community. Please tell other users about these changes. Not all changes will affect you. Translations are available. Recent…

Specbee: Getting started with integrating Drupal and Tailwind CSS

Posted on June 18, 2024 by Michael G
If you’re tired of spending hours tweaking CSS stylesheets to get your website looking just right, then you should consider a new way of CSS’ing (yeah, we just made it up). We’re talking about Tailwind CSS – a different way of doing CSS. It uses a utility-first approach, which means instead of creating a class for a component, let’s say a button, you would use a pre-defined class that’s built to style the button, like a “font-bold” or a “text-white”. All of this right from the comfort of your HTML! 
Couple Tailwind CSS, a sleek, utility-based open-source CSS framework, with a modular, highly customizable, and modern CMS like Drupal 10, and you have a powerhouse combination! 
In this article, we’ll be talking about Drupal and Tailwind CSS AND how you can integrate them seamlessly to build modern, responsive, and visually stunning websites

Why Drupal is a good choice for web development
Drupal is an open-source content management system (CMS) that has been gaining popularity among web developers for its versatility and powerful features. The latest version, Drupal 10 brings a host of new features and improvements meant to simplify development and enhance user experience.
1. Highly customizable design: One of the biggest advantages of using Drupal is its highly customizable design. With a wide range of themes and templates available, developers have the freedom to create unique and visually appealing websites that cater to their client’s specific needs.
2. Flexibility and scalability: Drupal’s modular architecture makes it incredibly flexible and scalable, making it suitable for building websites of any size or complexity. It offers a vast library of modules that can be easily integrated into your website, providing additional functionality such as e-commerce capabilities, social media integration, multilingual support, and more.
3. Robust security measures: Security is a major concern in today’s times; hence it is crucial to choose a CMS that prioritizes it. Drupal has always been recognized as one of the most secure CMS platforms due to its stringent security standards and frequent updates that address any potential vulnerabilities promptly. 
4. SEO-friendly: Search Engine Optimization (SEO) is vital for every website’s success as it determines its visibility on search engines like Google. Drupal’s built-in SEO tools assist developers in optimizing their websites by generating search engine-friendly URLs, meta tags, and sitemaps, and providing customizable page titles and descriptions.
5. Active community support: Drupal benefits from a substantial and engaged group of developers who contribute to its ongoing evolution and offer support to fellow users. This community-driven approach ensures that any issues or bugs are addressed promptly, and new updates and features are released regularly.
Why Tailwind CSS is great for web developers
Tailwind CSS has gained immense popularity in the web development community due to its numerous benefits and advantages. 
1. Highly customizable: One of the biggest advantages of Tailwind CSS is its high level of customization. Unlike other popular front-end frameworks like Bootstrap or Foundation, Tailwind does not come with predefined styles and components. Instead, it provides a comprehensive set of utility classes that can be used to create custom designs according to your specific project needs. This allows developers to have complete control over their designs and enables them to create unique and personalized user experiences.
2. Lightweight: Another major benefit of using Tailwind CSS is its lightweight nature. Since it only generates the required classes based on your design choices, it helps keep the file size small and improves website performance. This is especially beneficial for Drupal websites which often have heavy content and functionality that can slow down page loading speed.
3. Mobile-responsive: With more people accessing websites through mobile devices, having a mobile-responsive design has become crucial for any website’s success. The use of Tailwind CSS makes it easier to create responsive designs without adding extra code or media queries. Its mobile-first approach ensures that your website looks great on all screen sizes without compromising on performance.
4. Faster development process: By eliminating the need for manually writing complex CSS rules, Tailwind speeds up the development process significantly. It also reduces the chances of errors as developers can easily reuse existing utility classes instead of creating new ones from scratch every time they need a similar style element.
5. Scalable designs: With Tailwind CSS, you can create scalable designs that are easy to maintain and modify in the long run. As your website grows and evolves, making changes to its design becomes more manageable with Tailwind’s utility classes, as opposed to traditional frameworks where modifying styles can be a tedious process.
Why Integrate Drupal with Tailwind CSS?
One of the main reasons to integrate Drupal with Tailwind CSS is its ability to simplify web development. With Tailwind CSS, developers can avoid writing repetitive and lengthy code for styling. Instead, they can use pre-built classes that provide consistent and reusable design patterns. This not only saves time but also results in cleaner code that is easier to maintain.
Another benefit of integrating Drupal with Tailwind CSS is its responsive design capabilities. With the increasing use of mobile devices, it has become essential for websites to be optimized for all screen sizes. Thanks to Tailwind’s built-in responsive utilities, designers can easily build responsive layouts without having to write separate media queries for different devices.
Step-by-Step Guide to Integrating Drupal with Tailwind CSS
Step 1: Get your prerequisites ready

Local Drupal Setup
NPM and Yarn package Managers
Drush
Lando

Step 2: Create a custom theme
We will begin by creating a Drupal custom theme and then will integrate Tailwind CSS into the same.

In this tutorial, I am using the starter kit theme command to generate my custom theme.
Go to the web directory and type in the following command in the terminal
php core/scripts/drupal generate-theme drupal_tailwind_theme after pressing the enter key our custom theme will be generated as shown below:

Next, we will generate the package.json file which we require to initialize a new node.js project.

Go to the terminal and type in the following command npm init and it prompts us with a series of questions regarding our project since for this tutorial I am keeping everything default by pressing the enter key until our package.json file is added as shown in the image.

Step 3: Install and set up Tailwind CSS

Now let’s install Tailwind and its dependencies and also configure it.
In the terminal, run the following command:npm install -D tailwindcss postcss autoprefixer
Next, let’s generate a Tailwind CSS config file using the following command:npx tailwindcss init -p
Go to the tailwind.config.js file and set the path for Tailwind to scan. Since our Twig templates are in the templates directory, we will use that path as shown in the image.

Now we need to create a CSS file to put the Tailwind directives in.
Go to the src folder, create a file named index.css, and paste the following directives:@tailwind base;@tailwind components;@tailwind utilities;

 

Create a folder where the Tailwind CSS will be compiled. On the same level as the src folder, create a folder named dist (or any name you prefer).

We now run the following command:npx tailwindcss –input src/index.css –output dist/index.css After executing this command, we will be able to see the compiled version of the Tailwindcss in the dist folder.
We can verify it by going to the dist folder as shown in the image.

In the package.json file, we will be adding the scripts dev and watch which can be executed using npm run dev & npm run watch or using yarn dev & yarn watch.
The script dev compiles the code once as per command while the watch command keeps a watch on any change.

Step 4: Adding Tailwind CSS to our Drupal Theme

Now we will be adding Tailwind to our Drupal site. For that, we can add a library namely tailwind, and give it a CSS path of the dist/index.css. That means where we have our compiled tailwind.

Next, we can add that library either globally or to the specific template. For the purpose of this tutorial, I will be adding it globally.

Using Tailwind CSS in our Drupal theme
For this tutorial, I am using the page.html.twig file and adding a red background color by including the class bg-red-500 in the markup. Clear the cache and check the output. Our Tailwind CSS class has applied the desired background color.

 

Final Thoughts
Tailwind CSS is a great choice when you want to build websites quickly and easily. It integrates well with Drupal and the combination of these two tools creates a powerful synergy for web development. Reach out to us if you would like to learn more about how Specbee’s Drupal experts can help you create stunning web experiences with Drupal and Tailwind CSS.

Measuring Ruby Garbage Collector

Posted on June 18, 2024 by Michael G
The Garbage Collector releases memory slots from unused objects. However, it interrupts the Ruby execution and might significantly increase requests’ response time. Would you like to know how the GC slows down your app? https://www.rorvswild.com/blog/2024/measuring-ruby-garbage-collector

Open Source AI Definition – Weekly update June 17

Posted on June 18, 2024 by Michael G
Busy? Catch up on the Open Source AI Definition here!
  • Previous
  • 1
  • …
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • …
  • 821
  • Next

Recent Posts

  • [TUT] LoRa & LoRaWAN – MikroTik wAP LR8 kit mit The Things Network verbinden [4K | DE]
  • Mercado aguarda Powell e olha Trump, dados e Haddad | MINUTO TOURO DE OURO – 11/02/25
  • Dan Levy Gets Candid About Learning How To Act Differently After Schitt’s Creek: ‘It’s Physically…
  • Building a Rock Shelter & Overnight Stay in Heavy Snow 🏕️⛰️
  • Les milliardaires Elon Musk et Xavier Niel s’insultent copieusement

Categories

  • Android
  • Linux
  • News
  • Open Source
©2025 Open World News | Powered by Superb Themes
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT