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?

CommentFileSizeAuthor
#1 taxonomy_manager.module.patch2.28 KBjsobiecki
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jsobiecki’s picture

Status: Active » Needs review
FileSize
2.28 KB

I added patch which describes changes made in _taxonomy_manager_tree_get_item

mh86’s picture

Hi!

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).

jsobiecki’s picture

Hi,

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)
(...)
else {
  $tree = taxonomy_get_tree($vid, $parent);
}

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.

ivnish’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)