This is a follow-up from #1552396: Convert vocabularies into configuration
from /core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php
value_form()
$options = array();
$query = db_select('taxonomy_term_data', 'td');
//$query->innerJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid');
$query->fields('td');
// @todo Sorting on vocabulary weight and name.
//$query->orderby('tv.weight');
//$query->orderby('tv.name');
$query->orderby('td.weight');
$query->orderby('td.name');
$query->addTag('term_access');
if ($this->options['limit']) {
$query->condition('td.vid', $vocabulary->id());
}
$result = $query->execute();
foreach ($result as $term) {
$options[$term->tid] = $term->name;
}
| Comment | File | Size | Author |
|---|
Issue fork drupal-1821274
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:
Comments
Comment #1
andypostComment #2
imyaro commentedWe still have comment
As for me - it should be removed if it works as designed.
Comment #3
imyaro commentedComment #7
andypostComment #9
klonos...well, only name should be a matter for this issue, since vocabulary weight is to be deprecated: #3008064: Deprecate vocabulary weight property
Right?
Comment #15
liquidcms commentedWhy is this "as designed"? and why was being able to sort by vocab removed?
Comment #19
quietone commentedClosed #3069616: The ordering of Vocabularies on field settings doesn't follow the order on the vocabulary listing page as a duplicate.
Comment #20
wim leersPer @catch in #3008064-31: Deprecate vocabulary weight property:
Closed that issue in favor of this issue. 👍
Comment #24
jibranCreated the MR https://git.drupalcode.org/project/drupal/-/merge_requests/16596 for this.
TaxonomyIndexTid::valueForm()only ordered terms by their own weight/name when a filter spans multiple vocabularies and not by the vocabulary's weight.Since
taxonomy_termis a content entity andtaxonomy_vocabularyis a config entity, this can't be expressed as a singleEntityQuerysort, so the fix keeps the existing weight/name-sorted query and stably sorts the loaded terms by their vocabulary's weight afterward (loading only the vocabularies actually referenced, not all of them). Because the sort is stable, terms within the same vocabulary keep their existing weight/name order.Added
TaxonomyIndexTidFilterTest::testValueFormVocabularyWeightOrdering()covering the ordering.This issue now depends on #2495191: VocabularyInterface does not define a weight accessor for
Vocabulary::getWeight().Comment #25
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #26
jibran#25 has already been addressed.
Comment #27
smustgrave commentedThe IS is incomplete for this one. But if it's dependent on another issue it should be postponed too.