Hello,

with the following piece of code:

$vocabulary=taxonomy_vocabulary_machine_name_load('type_d_organisation');
	$typeOrg = array();
	if($vocabulary) $typeOrg  = entity_load('taxonomy_term', FALSE, array('vid' => $vocabulary->vid));

I have the following error:

Fatal error: Maximum function nesting level of '300' reached, aborting! in C:\wamp\www\includes\database\database.inc on line 2147

there are 3 terms in the vocabulary

I have increase the parameter:

xdebug.max_nesting_level

up to 1000

in the php.ini file as specified in many forums

But I have the same issue!!!

Any ideas???

Thanks

Didier

Comments

nevets’s picture

How about if you use

$vocabulary = taxonomy_vocabulary_machine_name_load('type_d_organisation');
$typeOrg = array();
if($vocabulary) $typeOrg  = taxonomy_get_tree($vocabulary->vid);
dihonore’s picture

	$vocabulary=taxonomy_vocabulary_machine_name_load('type_d_organisation');
	$typeOrg = array();
	if($vocabulary) $typeOrg  = taxonomy_get_tree($vocabulary->vid);

message:

Warning : strlen() expects parameter 1 to be string, object given dans drupal_validate_utf8() (ligne 1594 dans C:\wamp\www\includes\bootstrap.inc).
Recoverable fatal error : Object of class stdClass could not be converted to string dans filter_xss() (ligne 1440 dans C:\wamp\www\includes\common.inc).

another idea???

nevets’s picture

What is the context of your code, where does it exist? How is it called?

dihonore’s picture

my hook menu:

		$items['ajout_organisation'] = array(
		'title' => '',
		'page callback' => 'drupal_get_form',
		'page arguments' => array('rse_ajout_organisation_form'),
		'access callback' => TRUE,
	);

My function:


function rse_ajout_organisation_form($form, &$form_state)
{

	// On charge la taxo type d'organisation (vid = 6)

  	$vocabulary=taxonomy_vocabulary_machine_name_load('type_d_organisation');
	$typeOrg = array();
	if($vocabulary) $typeOrg  = taxonomy_get_tree($vocabulary->vid);


		
    // Select type d'organisation
	$form['type_organisation'] = array(
		'#type' => 'radios',
		'#title' => t('Type d\'organisation'),
		'#options' => $typeOrg,
	);
;


 return $form;
 
 }

nevets’s picture

'#options' needs to be a key value pair, taxonomy_get_tree returns a list of taxonomy terms, you need to use that list to make an array suitable for #options.

dihonore’s picture

the right code:


  	$vocab=taxonomy_vocabulary_machine_name_load('type_d_organisation');
	$terms = array();
	if($vocab) $terms  = entity_load('taxonomy_term', FALSE, array('vid' => $vocab->vid));

	$typeOrg = array();

	$value_tid=null;
	foreach($terms as $value)
		  {
		  		if ($value_tid==null) {
		  			$value_tid=$value->tid;
		  		}
				$typeOrg[$value->tid] = $value->name;
		  }
	
	
    // Select type d'organisation
	$form['type_organisation'] = array(
		'#type' => 'radios',
		'#title' => t('Type d\'organisation'),
		'#options' => $typeOrg,
	);