View source
<?php
define('CURRENT_SEARCH_DISPLAY_KEYS', 0);
define('CURRENT_SEARCH_DISPLAY_ALWAYS', 1);
define('CURRENT_SEARCH_DISPLAY_FILTERS', 2);
define('CURRENT_SEARCH_DISPLAY_KEYS_FILTERS', 3);
require_once dirname(__FILE__) . '/current_search.block.inc';
function current_search_menu() {
$items = array();
$items['admin/settings/current_search/item/%current_search_item/delete/%'] = array(
'title' => 'Revert current search block configuration',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'current_search_delete_item_form',
5,
7,
),
'access arguments' => array(
'administer search',
),
'type' => MENU_NORMAL_ITEM,
'file' => 'plugins/export_ui/current_search_export_ui.class.php',
);
return $items;
}
function current_search_menu_alter(&$items) {
$base_path = 'admin/settings/current_search';
foreach ($items as $path => $item) {
if ($base_path == $path || 0 === strpos($path, "{$base_path}/")) {
$items[$path]['access callback'] = 'facetapi_access_callback';
$items[$path]['access arguments'] = array();
}
}
$item =& $items['admin/settings/current_search/list/%ctools_export_ui/edit'];
$item['title'] = 'Configure current search items';
$item['type'] = MENU_CALLBACK;
}
function current_search_theme() {
module_load_include('php', 'ctools', 'plugins/export_ui/ctools_export_ui.class');
return array(
'current_search_group_title' => array(
'arguments' => array(
'title' => NULL,
),
'file' => 'current_search.theme.inc',
),
'current_search_text' => array(
'arguments' => array(
'text' => NULL,
'wrapper' => NULL,
'element' => NULL,
'css' => NULL,
'class' => NULL,
),
'file' => 'current_search.theme.inc',
),
'current_search_link_active' => array(
'arguments' => array(
'text' => NULL,
'path' => NULL,
'options' => array(),
),
'file' => 'current_search.theme.inc',
),
'current_search_keys' => array(
'arguments' => array(
'keys' => NULL,
'adapter' => NULL,
),
'file' => 'current_search.theme.inc',
),
'current_search_deactivate_widget' => array(
'file' => 'current_search.theme.inc',
),
'current_search_item_wrapper' => array(
'render element' => 'element',
'file' => 'current_search.theme.inc',
),
'current_search_group_wrapper' => array(
'render element' => 'element',
'file' => 'current_search.theme.inc',
),
'current_search_sort_settings_table' => array(
'render element' => 'element',
'file' => 'plugins/export_ui/current_search_export_ui.class.php',
),
);
}
function current_search_ctools_plugin_api($owner, $api) {
if ('current_search' == $owner && 'current_search' == $api) {
return array(
'version' => 1,
);
}
}
function current_search_ctools_plugin_directory($module, $type) {
if ('ctools' == $module && 'export_ui' == $type) {
return 'plugins/export_ui';
}
if ('current_search' == $module) {
return 'plugins/current_search';
}
}
function current_search_ctools_plugin_items() {
return array(
'use hooks' => TRUE,
);
}
function current_search_get_plugins() {
$plugins =& ctools_static(__FUNCTION__, array());
if (!$plugins) {
foreach (ctools_get_plugins('current_search', 'items') as $id => $plugin) {
$plugins[$id] = $plugin['handler']['label'];
}
}
return $plugins;
}
function current_search_get_searcher_options() {
$options = array();
foreach (facetapi_get_searcher_info() as $name => $info) {
$options[$name] = $info['label'];
}
return $options;
}
function current_search_item_load($name) {
ctools_include('export');
$result = ctools_export_crud_load('current_search', $name);
return $result ? $result : FALSE;
}
function current_search_current_search_items() {
$path = drupal_get_path('module', 'current_search') . '/plugins/current_search';
return array(
'current_search_item' => array(
'handler' => array(
'label' => t('Abstract class for Current Search items'),
'class' => 'CurrentSearchItem',
'abstract' => TRUE,
'path' => $path,
'file' => 'item.inc',
),
),
'text' => array(
'handler' => array(
'label' => t('Custom text'),
'class' => 'CurrentSearchItemText',
'parent' => 'current_search_item',
'path' => $path,
'file' => 'item_text.inc',
),
),
'active' => array(
'handler' => array(
'label' => t('Active items'),
'class' => 'CurrentSearchItemActive',
'parent' => 'current_search_item',
'path' => $path,
'file' => 'item_active.inc',
),
),
'group' => array(
'handler' => array(
'label' => t('Field group'),
'class' => 'CurrentSearchGroup',
'parent' => 'current_search_item',
'path' => $path,
'file' => 'item_group.inc',
),
),
);
}