Sven Decabooter: How to add classes / attributes to Drupal 8 local tasks

Planet Drupal - 15 April 2019 - 2:17am
How to add classes / attributes to Drupal 8 local tasks

Drupal 8 allows you to define custom tabs (a.k.a. local tasks) in your custom module.
For theming purposes, it might be necessary to add a class, ID, or other HTML attribute to the tab link.

Here is how this can be achieved when defining the local task in your [modulename].links.task.yml:

entity.node.custom: route_name: entity.node.custom base_route: entity.node.canonical title: 'Custom local task / tab' options: attributes: class: - 'my-custom-class'

If you want to add an attribute to a local task that is not defined in your custom module, you could use a preprocess function in your theme or module:

/** * Implements hook_preprocess_menu_local_task(). */ function MYTHEME_preprocess_menu_local_task(&$variables) { /** @var \Drupal\Core\Url $url */ $url = $variables['link']['#url']; if ($url instanceof \Drupal\Core\Url && $url->getRouteName() == 'entity.node.custom') { $variables['link']['#options']['attributes']['class'][] = 'my-custom-class'; } }

Replace the route name in the example above, with the route name of the tab you wish to change the HTML attributes for.

Sven Decabooter Mon, 04/15/2019 - 11:17
Categories: Drupal

Font Awesome fields

New Drupal Modules - 15 April 2019 - 1:28am

Integrates Drupal with Font Awesome
the web's most popular icon set and toolkit.

Categories: Drupal

Group Commerce

New Drupal Modules - 14 April 2019 - 11:32pm

Group extension module for commerce

Categories: Drupal

Test Security

New Drupal Modules - 14 April 2019 - 10:19pm

A test Security issue

Please do not download in a production env

Categories: Drupal

Conference Suite

New Drupal Modules - 14 April 2019 - 3:53pm
Categories: Drupal

Link field display mode formatter

New Drupal Modules - 14 April 2019 - 11:59am
  • Adds a formatter for link fields that displays the current entity with another view mode inside the link.
  • It can be configured to display the rendered fields as inline (CSS: display: inline)
Use case
Categories: Drupal

Static Content Iframe

New Drupal Modules - 13 April 2019 - 1:16pm

It may not ever really be a great idea, but sometimes you just need to host some static HTML content. For instance, you may have inherited a single-page app that works perfectly and all you want to do is put a branding wrapper around it. Or you might have something like an Adobe Captivate HTML5 export that you want to embed in your site.

Categories: Drupal

Shortcode bootstrap layout editor

New Drupal Modules - 13 April 2019 - 11:46am

This module only supports theme bootstrap 3 administration.
Before installing Bootstrap Shortcode layout editor, it must install shortcode fontawesome module
- Add a new format for content text admin/config/content/format
- enable the Shortcodes Bootstrap Editor option
- Activate some desired functions in the optional filter

Categories: Drupal

Seattle by night

Dries Buytaert - 13 April 2019 - 10:24am

It has been awhile since I added to my "Cities by night" photography series. Below are some photos from Pike Place Market, Seattle's epicenter of fresh produce, flowers and independent businesses.

Categories: Drupal


New Drupal Modules - 13 April 2019 - 10:23am

-------------------------------------------- UNDER CONSTRUCTION --------------------------------------------

Categories: Drupal

Lazy Image Style

New Drupal Modules - 13 April 2019 - 2:52am

# Lazy Image Style

This module add support lazy image for image styles.

Categories: Drupal

Commerce Order Item Addon

New Drupal Modules - 12 April 2019 - 11:09pm


Categories: Drupal

Advance Fivestar Rating

New Drupal Modules - 12 April 2019 - 4:09pm
Categories: Drupal


New Drupal Modules - 12 April 2019 - 4:03pm
Categories: Drupal

Jeff Geerling's Blog: Running Drupal in Kubernetes with Docker in production

Planet Drupal - 12 April 2019 - 4:00pm

Since 2014, I've been working on various projects which containerized Drupal in a production environment. There have always been a few growing pains—there will for some time, as there are so few places actually using Docker or containers in a production environment (at least in a 'cloud native' way, without tons of volume mounts), though this is changing. It was slow at first, but it's becoming much more rapid.

You might think that Drupal and Docker work together nicely. They definitely can and do, in many cases, as we see with local development environments built around Docker, like Docksal, Ddev, Lando, and even Drupal VM. But local development environments, where the Drupal codebase is basically mounted as a volume into a Docker container that runs the code, differ radically from production, where the goal is to 'contain' as much of production into a stateless container image as possible, so you can scale up, deploy, and debug most efficiently.

Categories: Drupal

Drupal blog: The privilege of free time in Open Source

Planet Drupal - 12 April 2019 - 3:29pm

This blog has been re-posted and edited with permission from Dries Buytaert's blog.

Open Source communities often incorrectly believe that everyone can contribute. Unfortunately, not everyone has equal amounts of free time to contribute.

On this page:

In Open Source, there is a long-held belief in meritocracy, or the idea that the best work rises to the top, regardless of who contributes it. The problem is that a meritocracy assumes an equal distribution of time for everyone in a community.

Open Source is not a meritocracy

I incorrectly made this assumption myself, saying: The only real limitation [to Open Source contribution] is your willingness to learn.

Today, I've come to understand that inequality makes it difficult for underrepresented groups to have the "free time" it takes to contribute to Open Source.

For example, research shows that women still spend more than double the time as men doing unpaid domestic work, such as housework or childcare. I've heard from some of my colleagues that they need to optimize every minute of time they don't spend working, which makes it more difficult to contribute to Open Source on an unpaid, volunteer basis.

Or, in other cases, many people's economic conditions require them to work more hours or several jobs in order to support themselves or their families.

Systemic issues like racial and gender wage gaps continue to plague underrepresented groups, and it's both unfair and impractical to assume that these groups of people have the same amount of free time to contribute to Open Source projects, if they have any at all.

What this means is that Open Source is not a meritocracy.

Free time is a mark of privilege, rather than an equal right. Instead of chasing an unrealistic concept of meritocracy, we should be striving for equity. Rather than thinking, "everyone can contribute to open source", we should be thinking, "everyone deserves the opportunity to contribute".

Time inequality contributes to a lack of diversity in Open Source

This fallacy of "free time" makes Open Source communities suffer from a lack of diversity. The demographics are even worse than the technology industry overall: while 22.6% of professional computer programmers in the workforce identify as women (Bureau of Labor Statistics), less than 5% of contributors do in Open Source (GitHub). And while 34% of programmers identify as ethnic or national minorities (Bureau of Labor Statistics), only 16% do in Open Source (GitHub).

It's important to note that time isn't the only factor; sometimes a hostile culture or unconscious bias play a part in limiting diversity. According to the same GitHub survey cited above, 21% of people who experienced negative behavior stopped contributing to Open Source projects altogether. Other recent research showed that women's pull requests were more likely to get accepted if they had a gender-neutral username. Unfortunately, examples like these are common.

Taking action: giving time to underrepresented groups

While it's impossible to fix decades of gender and racial inequality with any single action, we must do better. Those in a position to help have an obligation to improve the lives of others. We should not only invite underrepresented groups into our Open Source communities, but make sure that they are welcomed, supported and empowered. One way to help is with time:

  • As individuals, by making sure you are intentionally welcoming people from underrepresented groups, through both outreach and actions. If you're in a community organizing position, encourage and make space for people from underrepresented groups to give talks or lead sprints about the work they're interested in. Or if you're asked to, mentor an underrepresented contributor.
  • As organizations in the Open Source ecosystem, by giving people more paid time to contribute.

Taking the extra effort to help onboard new members or provide added detail when reviewing code changes can be invaluable to community members who don't have an abundance of free time. Overall, being kinder, more patient and more supportive to others could go a long way in welcoming more people to Open Source.

In addition, organizations within the Open Source ecosystem capable of giving back should consider financially sponsoring underrepresented groups to contribute to Open Source. Sponsorship can look like full or part-time employment, an internship or giving to organizations like Girls Who CodeCode2040Resilient Coders or one of the many others that support diversity in technology. Even a few hours of paid time during the workweek for underrepresented employees could help them contribute more to Open Source.

Applying the lessons to Drupal

Over the years, I've learned a lot from different people's perspectives. Learning out in the open is not always easy, but it's been an important part of my personal journey.

Knowing that Drupal is one of the largest and most influential Open Source projects, I find it important that we lead by example.

I encourage individuals and organizations in the Drupal community to strongly consider giving time and opportunities to underrepresented groups. You can start in places like:

When we have more diverse people contributing to Drupal, it will not only inject a spark of energy, but it will also help us make better, more accessible, inclusive software for everyone in the world.

Each of us needs to decide if and how we can help to create equity for everyone in Drupal. Not only is it good for business, it's good for people, and it's the right thing to do.

Special thanks to the Drupal Diversity and Inclusion group for discussing this topic with me.

 April 10, 2019

 3 min read time


Categories: Drupal


New Drupal Modules - 12 April 2019 - 12:09pm

Your one-stop for integrating webinars service in Drupal.

This module allows you to add online collaborative services including web seminars, webcasts, and peer-level web meetings.

Categories: Drupal

Qumu Video

New Drupal Modules - 12 April 2019 - 11:57am

The Qumu Enterprise Video Platform is a true, end-to-end solution for delivering live and on demand corporate video globally to any device—securely, and with no buffering or loss of video quality.

Categories: Drupal

Visitor Analytics

New Drupal Modules - 12 April 2019 - 9:57am

Visitor Analytics integrates your Drupal site with https://www.visitor-analytics.io/ tracker. Statistics are available right inside Drupal admin as well.


You can install the module as usual.

Categories: Drupal

Drupal Commerce Bluesnap

New Drupal Modules - 12 April 2019 - 9:51am

This module integrates BlueSnap with Drupal Commerce, providing a tokenized payment gateway.

Categories: Drupal


Subscribe to As If Productions aggregator - Drupal