Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I had encounter such problem in taxonomy_manger admin form:
I wanted to limit terms set in taxonomy_manager admin form. I chose to use hook_db_rewrite_sql as ad-hoc solution. But in implementation of function _taxonomy_manager_tree_get_item none of queries is decorated with db_rewrite_sql. Is there any important reason for not using db_rewrite_sql in this function?
Comment | File | Size | Author |
---|---|---|---|
#1 | taxonomy_manager.module.patch | 2.28 KB | jsobiecki |
Comments
Comment #1
jsobiecki CreditAttribution: jsobiecki commentedI added patch which describes changes made in _taxonomy_manager_tree_get_item
Comment #2
mh86 CreditAttribution: mh86 commentedHi!
If you want to limit terms, you can configure it under Administration > Site Configuration > Taxonomy Manager - Pager Count (or you can directly set the variable 'taxonomy_manager_pager_tree_page_size' with variable_set('taxonomy_manager_pager_tree_page_size', 50)).
Your patch looks good, but before I can commit it, I have to check which module alter these queries and might change the tree in the taxonomy manager admin interface (e.g. if its still working if i18n is enabled).
Comment #3
jsobiecki CreditAttribution: jsobiecki commentedHi,
Thanks for response :)
I didn't want limit amount of terms per page. I wanted to limit set of terms according to some conditions (in this case, assignment of term to domain, made by domain_taxonomy module).
It is good approach to make sure if this wont break admin interface, but take notice on this fragment of code in _taxonomy_manager_tree_get_item:
if $pager parameter is set to FALSE, you use taxonomy_get_tree function. And this function uses db_rewrite_sql. So currently, _taxonomy_manager_tree_get_item might act differently according to $pager parameter value.
Comment #4
ivnish CreditAttribution: ivnish commented