/*
 *  Copyright 2014 Anyware Services
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

/**
 * Extension Search Tool
 * @private
 */
Ext.define('Ametys.plugins.cms.search.ContentSearchToolExtensions', {
	
	singleton: true,
	
	/**
	 * @property {Object} The configuration of additional buttons/menus
	 * @private
	 */
	_additionalButtons: {},
	
	/**
	 * Registers a extra button/menu to be added to search bar
	 * @param {Object} config The button/menu configuration
	 * @param {String} [location=l] The buttons location ('l' for left or 'r' for right)
	 */
	registerAdditionalButton: function (config, location)
	{
		location = location || 'l';
		if (!this._additionalButtons[location])
		{
			this._additionalButtons[location] = [];
		}
		this._additionalButtons[location].push(config);
	},
	
	/**
	 * Get the registered additional buttons/menus to be added to search bar
	 * @param {String} [location=l] The buttons location ('l' for left or 'r' for right)
	 * @return {Object[]} The elements to add to search bar
	 */
	getAdditionalButtons: function(location)
	{
		location = location || 'l';
		return this._additionalButtons[location];
	}
});