<?php
	class qa_slang_admin {

		function option_default($option) {
			
			switch($option) {
				case 'lang_switch_title':
					return 'Language';
				default:
					return null;				
			}
			
		}	   
			
		function admin_form(&$qa_content)
		{					   

		// Process form input
			
			$ok = null;
			
			if (qa_clicked('lang_switch_save')) {	

				qa_opt('lang_switch_enable',(bool)qa_post_text('lang_switch_enable'));
				qa_opt('lang_switch_title',qa_post_text('lang_switch_title'));

				$ok = qa_lang('admin/options_saved');
			}
			
					
			// Create the form for display
			
			$themes = qa_admin_theme_options();
			
			$fields = array();
			
			$fields[] = array(
				'label' => 'Enable Language switching',
				'tags' => 'NAME="lang_switch_enable"',
				'value' => qa_opt('lang_switch_enable'),
				'type' => 'checkbox',
			);
				
			$fields[] = array(
				'label' => 'Language switch title',
				'type' => 'text',
				'value' => qa_html(qa_opt('lang_switch_title')),
				'tags' => 'NAME="lang_switch_title"',
			);

			return array(		   
				'ok' => ($ok && !isset($error)) ? $ok : null,
					
				'fields' => $fields,
			 
				'buttons' => array(
					array(
						'label' => 'Save',
						'tags' => 'NAME="lang_switch_save"',
					)
				),
			);
		}
	}

