When you install Admin Views, a new command appears in admin/content, named "Modify entity values". When you execute that action, a large form appears which gathers all possible fields for selected content items. Apparently it cannot handle fields set to use TRT. The messages are:

Notice: Undefined index: in _term_reference_tree_get_options() (line 217 of /sites/all/modules/term_reference_tree/term_reference_tree.module).
Notice: Undefined property: stdClass::$children in _term_reference_tree_build_item() (line 679 of /sites/all/modules/term_reference_tree/term_reference_tree.widget.inc).

Comments

FranckV’s picture

Status: Active » Needs review

I had the same issue with version 7.x-1.9. The issue seems to come from a bad treatment when dealing with a non mandatory field where the "N/A" empty case generates a null.
Here is my fix, it should work for most of the case :

ORIGINAL CODE in modules/term_reference_tree/term_reference_tree.module

function _term_reference_tree_get_options(&$terms, &$allowed, $filter) {
  $options = array();

  if (is_array($terms) && count($terms) > 0) {
    foreach($terms as $term) {
	  if (!$filter || (is_array($allowed) && $allowed[$term->tid])) {   // *** issue as $term->tid is null for the empty option *** 
		$options[$term->tid] = entity_label('taxonomy_term', $term);
		$options += _term_reference_tree_get_options($term->children, $allowed, $filter);
	  }
    }
  }
  return $options;
}

NEW CODE in modules/term_reference_tree/term_reference_tree.module

function _term_reference_tree_get_options(&$terms, &$allowed, $filter) {
  $options = array();

  if (is_array($terms) && count($terms) > 0) {
    foreach($terms as $term) {
		if($term->tid)
		{
		  if (!$filter || (is_array($allowed) && $allowed[$term->tid])) {
			$options[$term->tid] = entity_label('taxonomy_term', $term);
			$options += _term_reference_tree_get_options($term->children, $allowed, $filter);
		  }
		}
		else
		{
			$options[] = entity_label('taxonomy_term', $term);
			$options += _term_reference_tree_get_options($term->children, $allowed, $filter);
		}
    }
  }
  return $options;
}
stongo’s picture

StatusFileSize
new775 bytes

FranckV, thanks for the suggestion, it is a good starting point. The else statement is extraneous and should still check the first condition in the OR.
Here's a simpler patch against 7.x-1.x-dev that fixes the same issue.

stongo’s picture

StatusFileSize
new659 bytes

Actually, scrap the above patch, all it needs is an isset() in the original if condition.
Here's another patch.

dave reid’s picture

Version: 7.x-2.x-dev » 7.x-1.x-dev
kbasarab’s picture

Issue summary: View changes
StatusFileSize
new660 bytes

Updates patch in #3 to apply to 7.x-1.10 and 7.x-1.x dev.

pifagor’s picture

Status: Needs review » Reviewed & tested by the community

Look good

  • alex_optim committed 860d654 on 7.x-1.x
    Issue #1564400 by kbasarab, alex_optim: Compatibility with Admin Views,...
alex_optim’s picture

Status: Reviewed & tested by the community » Patch (to be ported)
alex_optim’s picture

Status: Patch (to be ported) » Fixed
alex_optim’s picture

Status: Fixed » Closed (fixed)