Closed (fixed)
Project:
Taxonomy Menu
Version:
8.x-3.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
7 Jul 2016 at 09:31 UTC
Updated:
24 Aug 2017 at 08:15 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
akleinwaechter commentedI just added one line of code to make it work:
src -> Entity -> TaxonomyMenu.php
almost at the end:
// TODO: Consider implementing a forced weight based on taxonomy tree.
// Generate link.
$arguments = ['taxonomy_term' => $term_id];
$link = $base_plugin_definition;
$link += array(
'id' => $this->buildMenuPluginId($term),
'title' => $term->label(),
// Sascha: weight added
'weight' => $term->getWeight(),
'description' => $term->getDescription(),
'menu_name' => $menu_id,
'metadata' => array(
'taxonomy_menu_id' => $taxonomy_menu_id,
'taxonomy_term_id' => $term_id,
),
'route_name' => $term_url->getRouteName(),
'route_parameters' => $term_url->getRouteParameters(),
'load arguments' => $arguments,
'parent' => $menu_parent_id,
'provider' => 'taxonomy_menu',
'class' => 'Drupal\taxonomy_menu\Plugin\Menu\TaxonomyMenuMenuLink',
);
return $link;
}
}
Comment #3
luksakThis worked for me. Attaching a patch for this.
Comment #5
dstolThanks!
Comment #6
anouI do not think this is a good idea to make it automatic. I just wanted to create an issue where I was about to say that when I edit a taxonomy term, my taxonomy menu gets reordered!
Sorry to tell that this should not happen. The ordering of the menu must be independent from the ordering of the taxonomy.
The option I can see is to make it optional in the edit form of a term and/or in the edit form of the vocabulary, like a checkbox asking you if you want to order the taxonomy menu to reflect the taxonomy terms order...
Comment #7
anouComment #8
megadesk3000 commentedHi
I added a new patch. Now it is possible to configure whether the user wants to use the weight of the terms or sort alphabetically per taxonomy_menu entity.
Clear your cache after you installed patch and configure the taxonomy_menu entities to use the terms weight.
Greetings
Jan
Comment #9
megadesk3000 commentedComment #10
megadesk3000 commentedComment #11
mariacha1 commentedThis works great!
Checking the box to impose the weight and doing a cache clear makes my menu items show up in the weight order.
Unchecking that box and doing a cache clear returns them to alphabetical.
Comment #12
gaurav.kapoor commented+1 for RTBC.
Comment #13
pavelculacov commentedTested Worked
Comment #14
selfirian commentedIt does work but somehow whenever I save something else, the menu reverts to everything on the same line. It seems the weight gets respected but not the parent/child information.
Comment #15
luksakCould we get this committed?
Comment #16
eloivaque#8 patch works for me.
#10 doesn't work.
Comment #17
luksak#10 is an interdiff, not a patch.
Comment #18
dstol@Lukas, of course!
Thanks for the contributions!