hey all I am trying to add some menu options to my subtheme but to be able to do that I need to have theme-settings.php in my subtheme folder containing the following code

/**
 * Implements hook_form_system_theme_settings_alter()
 */
function mysubtheme_form_system_theme_settings_alter(&$form, &$form_state) {
// MENU =====================================  	

  $form['menu'] = array(
  '#type' => 'fieldset',
  '#title' => t('Menu settings'),
  '#collapsible' => TRUE,
  '#collapsed' => TRUE,
  );

  $form['menu']['menutype'] = array(
    '#type' => 'select',
    '#title' => t('Menu type'),
		'#options' => array(
			'dfission' => 'dFission',
			'suckerfish' => 'Suckerfish', 
			'splitmenu' => 'SplitMenu',
			'none' => "None"
		),
		'#description' => t('Type of menu for main navigation'),
    '#default_value' => theme_get_setting('menutype'),
  );
  
  $form['menu']['level2cols'] = array(
    '#type' => 'select',
    '#title' => t('Secondary Menu Columns'),
		'#options' => array(
			'1' => '1',
			'2' => '2'
		),
		'#description' => t('Columns for Level 1 Submenu'),
    '#default_value' => theme_get_setting('level2cols'),
  );
  $form['menu']['level3cols'] = array(
    '#type' => 'select',
    '#title' => t('3rd Menu Columns'),
		'#options' => array(
			'1' => '1',
			'2' => '2'
		),
		'#description' => t('Columns for Level 2 Submenu'),
    '#default_value' => theme_get_setting('level3cols'),
  );
  $form['menu']['menu_duration'] = array(
	    '#type' => 'textfield',
	    '#title' => t('Menu Duration'),
	 	'#prefix' => '<div class="escaped">',
	 	'#suffix' => '</div>',
	    '#default_value' => theme_get_setting('menu_duration'),
		'#size' => 10,
		'#required' => TRUE
	);

	$form['menu']['show_subtext_1'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show First Level Menu Subtext'),
    '#default_value' => theme_get_setting('show_subtext_1')
	);
	
	$form['menu']['show_subtext_2'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Second Level Menu Subtext'),
    '#default_value' => theme_get_setting('show_subtext_2')
	);
	
	$form['menu']['show_subtext_3'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show All Other Menu Subtext'),
    '#default_value' => theme_get_setting('show_subtext_3')
	);
	 // Return the additional form widgets
  return $form;
	
}

I did create the theme-settings.php including the above code but unfortunately Notice: Undefined variable: mysubtheme_menutype in region--menu.tpl.php keeps showing up

Q1: is this because we cannot have theme-settings.php file?
Q2: or, should I be placing the above code somewhere else?

Comments

kardave’s picture

This needs a place in the documentation. I found the solution but took several hours.
Although the custom setting gets saved, but you need to give your theme to the theme_get_setting() like this:

'#default_value' => theme_get_setting('level3cols', 'mysubtheme'),

I hope this help others too.