Problem/Motivation
HTML classes should be usually added in templates instead of preprocess functions

Proposed resolution
Move the HTML classes from the preprocess function to the template. The classes should be added in a template toolbar.html.twig but not in the module.

Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet

Comments

Hardik_Patel_12 created an issue. See original summary.

hardik_patel_12’s picture

Kindly review a new patch.

hardik_patel_12’s picture

Assigned: hardik_patel_12 » Unassigned
Status: Needs work » Needs review
kishor_kolekar’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new138.08 KB

@Hardik_Patel_12

#2 patch working for me LGTM added screenshot for review.

Thanks for the patch..!!

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs frontend framework manager review

I think this issue needs some more consideration. Firstly this template is part of classy and stable and this change affects those templates too. So we need to make the same template change there. Also any custom themes that override this template could be affected so we need a change record.

It'd be great if a frontend framework manager could decide whether we want to do this though as these classes are also part of the javascript the toolbar uses and so in this case maybe the module is the best place for them.

lauriii’s picture

This is one of the use cases where we probably want to keep the attributes in the preprocess function. Toolbar needs these for it to work properly, so generically people shouldn't make changes to these classes. As @alexpott pointed out, there's lots of themes out there that are overriding this template and would break as a result. Maybe the correct solution here would be to prefix these classes with js- to make it clear that these are needed by Toolbar JavaScript?

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

nikhil_110’s picture

StatusFileSize
new1.22 KB

Adding the patch for Drupal 10.1.x.
no Interdiff because #2 patch fail to apply.

nitin shrivastava’s picture

StatusFileSize
new376 bytes
new1.43 KB

Try to fix CCF ERROR

ricardofaria’s picture

StatusFileSize
new36.96 KB

#14 works for me.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

quietone’s picture

Status: Needs work » Postponed

The Toolbar Module was approved for removal in #3476882: [Policy] Move Toolbar module to contrib.

This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

The deprecation work is in #3484850: [meta] Tasks to deprecate Toolbar module and the removal work in #3488828: [meta] Tasks to remove Toolbar module.

Toolbar will be moved to a contributed project before Drupal 12.0.0 is released.

quietone’s picture

Project: Drupal core » Toolbar
Version: main » 1.x-dev
Component: toolbar.module » Code
Status: Postponed » Needs work

Toolbar module has moved to contrib.