'. t("Makes views draggable") .'

'; break; } return $output; } /** * Implementing hook_admin */ function draggableviews_admin() { $form['draggableviews_nmbr_values'] = array( '#type' => 'textfield', '#title' => t('Number values'), '#default_value' => variable_get('draggableviews_nmbr_values', 3), '#size' => 4, '#maxlength' => 4, '#description' => t('The number of draggableviews value fields that will be generated'), '#required' => TRUE, '#prefix' => 'The setting above will not take effect until the views cache gets cleared!', ); return system_settings_form($form); } /** * Implementing hook_validate */ function draggableviews_admin_validate($form, &$form_state) { $value = $form_state['values']['draggableviews_nmbr_values']; if (!is_numeric($value) OR $value < 0) { drupal_set_message('Invalid value (not numeric, not >= 0)', 'error'); } } /** * Implementing hook_menu */ function draggableviews_menu() { $items = array(); $items['admin/settings/draggableviews'] = array( 'title' => 'Draggable views settings', 'description' => 'Configure settings', 'page callback' => 'drupal_get_form', 'page arguments' => array('draggableviews_admin'), 'access arguments' => array('access administration pages'), 'type' => MENU_NORMAL_ITEM, ); return $items; } /** * Discover all Implementations for draggableviews * */ function draggableviews_discover_handlers($filter_handler = NULL) { $cache = array(); // Get implementation definitions from all modules. foreach (module_implements('draggableviews_handlers') as $module) { $function = $module .'_draggableviews_handlers'; $result = $function(); if (!is_array($result)) { continue; } $path = drupal_get_path('module', $module); foreach ($result as $handler => $def) { if (!isset($def['path'])) { $def['path'] = $path; } if (!isset($def['file'])) { $def['file'] = "$handler.inc"; } if (!isset($def['handler'])) { $def['handler'] = 'draggableviews_handler_'.$handler; } // merge the new data in $cache[$handler] = $def; } } if (isset($filter_handler)) { if (isset($cache[$filter_handler])) { return $cache[$filter_handler]; } else { return FALSE; } } return $cache; } /** * Return a list of all draggableviews handlers */ function draggableviews_get_handlers_list() { $handlers = draggableviews_discover_handlers(); foreach ($handlers as $handler => $def) { $list[$handler] = $def['title']; } return $list; } /** * Implementing hook_draggableviews_handlers */ function draggableviews_draggableviews_handlers() { return array( 'native' => array( 'file' => 'implementations/draggableviews_handler_native.inc', 'title' => t('Native'), 'description' => 'Storage of structure done by draggableviews', 'handler' => 'draggableviews_handler_native', ), ); } /** * Implementing hook_perm */ function draggableviews_perm() { return array('Allow Reordering'); } /** * Implementing hook_forms */ function draggableviews_forms() { $args = func_get_args(); $form_id = $args[0]; if (strpos($form_id, "draggableviews_view_draggabletable_form") === 0) { $forms[$form_id] = array( 'callback' => 'draggableviews_view_draggabletable_form', ); } return $forms; } /** * Implement hook_theme */ function draggableviews_theme() { $array = array(); $array['draggableviews_ui_style_plugin_draggabletable'] = array( 'arguments' => array('form' => NULL), ); $array['draggableviews_view_draggabletable_form_new'] = array( 'template' => 'draggableviews-view-draggabletable-form', 'preprocess functions' => array( 'template_preprocess_draggableviews_view_draggabletable_form', ), 'arguments' => array('form' => NULL), ); // register theme function for all views $views = views_get_all_views(); foreach ($views AS $view) { if (!isset($view->disabled) || $view->disabled === FALSE) { $array['draggableviews_view_draggabletable_form_'. $view->vid] = array( 'template' => 'draggableviews-view-draggabletable-form', 'preprocess functions' => array( 'template_preprocess_draggableviews_view_draggabletable_form', ), 'arguments' => array('form' => NULL), ); } } return $array; } /** * Impleneting hook_views_api */ function draggableviews_views_api() { return array( 'api' => 2.0, 'path' => drupal_get_path('module', 'draggableviews') .'/views', ); }