<menu> has made a comeback in HTML5, we can use menu to build menubar/toolbar type menus.

theme_links seems like a reasonable function to use to build a menubar (e.g. toolbar module uses theme_links), however its hard coded to use <ul>, so in the interest of flexibility I propose we could add a type parameter to theme_links e.g.

$type = $variables['type'];
...
$output .= "<$type" . drupal_attributes($attributes) . '>';
...
$output .= "</$type>";

http://api.drupal.org/api/drupal/includes--theme.inc/function/theme_links/8

Tangentially related issue: #1190210: Convert toolbar.tpl.php to HTML5

Issue fork drupal-1203908

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

  • 1203908-add-a-type Comparecompare

Comments

jessebeach’s picture

StatusFileSize
new1.82 KB

I've been wanting to do this for a long, long time. It took me a little while to figure out where the default arguments were being set, but once I found them in common.inc, it was smooth sailing.

jessebeach’s picture

Assigned: Unassigned » jessebeach
Status: Active » Needs review

Assigning this to me.

jessebeach’s picture

StatusFileSize
new1.53 KB

Apparently using the array key "#type" threw the contextual links into a tizzy.
https://skitch.com/jesse.beach/feb93/developer-tools-http-drupal.dev

Changed the array key so that the contextual links render correctly.

ericduran’s picture

Status: Needs review » Needs work

I think we might need to check the $list variable needs before just printing it.

ericduran’s picture

check plain should be enough being that the only expected option is a text string.

h3rj4n’s picture

Rewrote the patch to work with the new folder structure.

I think this feature improves HTML5 in Drupal. It might be better that the $list value is limited by a set of options to prevent the li tags of being wrapped out of context. Not shure if this should be checked on this location or that this is something a user should be aware of.

I created two patches. One with the limited options and one without it.

h3rj4n’s picture

Assigned: jessebeach » Unassigned
Status: Needs work » Needs review

forgot to set it to needs review

jessebeach’s picture

Status: Needs review » Reviewed & tested by the community

@ericduran, good thought about checking plain. We should be covered though, because the only three values allowed for list are 'menu', 'ul', or 'ol'.

$list_options = array('menu', 'ul', 'ol');
$list = (in_array($variables['list'], $list_options)) ? $variables['list'] : 'ul';

It should be possible to sneak anything else by.

This is really one of those Drupal WTF in the theming layer.

Thanks for updating this @h3rj4n.

I'm setting to RTBC to get this on folks' radars. It shouldn't be controversial.

catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

This needs tests.

Prefer the version that limits to known tags, definitely don't want a check plain here - if you let people put arbitrary HTML via a UI then you're responsible for adding appropriate permissions to that UI.

mgifford’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests, -html5
mgifford’s picture

Status: Needs review » Needs work

The last submitted patch, 6: 1203908-add_type_theme_links_with_options.patch, failed testing.

joelpittet’s picture

Version: 8.0.x-dev » 8.1.x-dev
Issue summary: View changes
Issue tags: +html5, +Needs tests

I'd rather not do this dynamic tags approach, maybe a template suggestion would be better but not sure. Regardless of my opinion this is not going to be in 8.0.0 so we need to move it to 8.1.x feature if someone wants to continue this approach.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

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

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). 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: 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.

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.

nlisgo made their first commit to this issue’s fork.

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.