Commit 863b3463 authored by tim.plunkett's avatar tim.plunkett

Issue #1741172 by tim.plunkett: Remove as much CTools code as possible, and...

Issue #1741172 by tim.plunkett: Remove as much CTools code as possible, and document the parts left to remove.
parent d2c9b80d
......@@ -220,6 +220,7 @@ function views_revert_view($view) {
// Revert the view.
$view->delete();
// Clear its cache.
// @todo Convert this: http://drupal.org/node/1658068.
ctools_include('object-cache');
ctools_object_cache_clear('view', $view->name);
// Give feedback.
......
......@@ -303,7 +303,6 @@ function views_ui_add_page() {
* Form builder for the "add new view" page.
*/
function views_ui_add_form($form, &$form_state) {
ctools_include('dependent');
$form['#attached']['js'][] = drupal_get_path('module', 'views_ui') . '/js/views-admin.js';
$form['#attributes']['class'] = array('views-admin');
......@@ -971,8 +970,7 @@ function views_ui_edit_form($form, &$form_state, $view, $display_id = NULL) {
// - Change $form_state['view'] to $form_state['temporary']['view'].
// - Add a #process function to initialize $form_state['temporary']['view']
// on cached form submissions.
// - Update ctools_include() to support cached forms, or else use
// form_load_include().
// - Use form_load_include().
$form_state['no_cache'] = TRUE;
if ($display_id) {
......@@ -984,8 +982,6 @@ function views_ui_edit_form($form, &$form_state, $view, $display_id = NULL) {
$view->fix_missing_relationships();
}
ctools_include('dependent');
$form['#attached']['js'][] = ctools_attach_js('dependent');
$form['#attached']['js'][] = ctools_attach_js('collapsible-div');
$form['#tree'] = TRUE;
......@@ -1196,7 +1192,6 @@ function views_ui_preview_form($form, &$form_state, $view, $display_id = 'defaul
'#type' => 'submit',
'#value' => t('Update preview'),
'#attributes' => array('class' => array('arguments-preview', 'ctools-auto-submit-click')),
'#pre_render' => array('ctools_dependent_pre_render'),
'#prefix' => '<div id="preview-submit-wrapper">',
'#suffix' => '</div>',
'#id' => 'preview-submit',
......@@ -4028,8 +4023,6 @@ function views_ui_add_item_form($form, &$form_state) {
),
);
ctools_add_js('dependent');
if (!$view->set_display($display_id)) {
views_ajax_error(t('Invalid display id @display', array('@display' => $display_id)));
}
......@@ -4137,7 +4130,6 @@ function views_ui_add_item_form($form, &$form_state) {
'#theme_wrappers' => array('form_element', 'views_container'),
'#attributes' => array('class' => array('container-inline', 'views-add-form-selected')),
);
ctools_include('dependent');
views_ui_standard_form_buttons($form, $form_state, 'views_ui_add_item_form', t('Add and configure @types', array('@types' => $ltitle)));
// Remove the default submit function.
......
......@@ -944,6 +944,8 @@ function build_group_form(&$form, &$form_state) {
$row['operator']['#title'] = '';
$this->value_form($row, $form_state);
// @todo: Convert this to #states.
ctools_include('dependent');
// Fix the dependencies to update value forms when operators
// changes. This is needed because forms are inside a new form and
// their ids changes. Dependencies are used when operator changes
......
......@@ -87,7 +87,6 @@ function build_form($form, &$form_state) {
':input[name="page[create]"]' => array('checked' => TRUE),
),
),
'#pre_render' => array('ctools_dependent_pre_render'),
'#prefix' => '<div><div id="edit-page-wrapper">',
'#suffix' => '</div></div>',
'#parents' => array('page'),
......@@ -200,7 +199,6 @@ function build_form($form, &$form_state) {
':input[name="page[feed]"]' => array('checked' => TRUE),
),
),
'#pre_render' => array('ctools_dependent_pre_render'),
'#prefix' => '<div id="edit-page-feed-properties-row-plugin-wrapper">',
'#suffix' => '</div>',
);
......@@ -228,7 +226,6 @@ function build_form($form, &$form_state) {
':input[name="block[create]"]' => array('checked' => TRUE),
),
),
'#pre_render' => array('ctools_dependent_pre_render'),
'#prefix' => '<div id="edit-block-wrapper">',
'#suffix' => '</div>',
'#parents' => array('block'),
......
......@@ -127,6 +127,7 @@ function load_row($data) {
* An optional indentation for prettifying nested code.
*/
function export_row($identifier = NULL, $indent = '') {
// @todo replace with http://drupal.org/node/1741154.
ctools_include('export');
if (!$identifier) {
......
......@@ -432,6 +432,7 @@ function options_form(&$form, &$form_state) {
$settings = $this->options['settings'] + field_info_formatter_settings($format);
// Provide an instance array for hook_field_formatter_settings_form().
// @todo Remove this: http://drupal.org/node/1741128.
ctools_include('fields');
$instance = ctools_fields_fake_field_instance($this->definition['field_name'], '_dummy', $formatter, $settings);
......
......@@ -94,7 +94,6 @@ function options_form(&$form, &$form_state) {
'#type' => 'radios',
'#title' => t('Multiple-value handling'),
'#default_value' => $this->options['anyall'],
'#process' => array('form_process_radios', 'ctools_dependent_process'),
'#options' => array(
',' => t('Filter to items that share all terms'),
'+' => t('Filter to items that share any term'),
......
......@@ -103,7 +103,7 @@ function views_api_minimum_version() {
*/
function views_theme($existing, $type, $theme, $path) {
$path = drupal_get_path('module', 'views');
ctools_include('theme', 'views', 'theme');
module_load_include('inc', 'views', 'theme/theme');
// Some quasi clever array merging here.
$base = array(
......@@ -1125,7 +1125,7 @@ function &views_get_current_view() {
* Include views .inc files as necessary.
*/
function views_include($file) {
ctools_include($file, 'views');
module_load_include('inc', 'views', 'includes/' . $file);
}
/**
......@@ -1138,6 +1138,8 @@ function views_module_include($api, $reset = FALSE) {
unset($cache['views']['views']);
}
}
// @todo replace with http://drupal.org/node/1741154.
ctools_include('plugins');
return ctools_plugin_api_include('views', $api, views_api_minimum_version(), views_api_version());
}
......@@ -1152,6 +1154,8 @@ function views_get_module_apis($api = 'views', $reset = FALSE) {
unset($cache['views']['views']);
}
}
// @todo replace with http://drupal.org/node/1741154.
ctools_include('plugins');
return ctools_plugin_api_info('views', $api, views_api_minimum_version(), views_api_version());
}
......@@ -1175,9 +1179,10 @@ function views_add_js($file) {
if (config('views.settings')->get('no_javascript')) {
return;
}
$path = drupal_get_path('module', 'views');
static $base = TRUE, $ajax = TRUE;
if ($base) {
drupal_add_js(drupal_get_path('module', 'views') . "/js/base.js");
drupal_add_js($path . "/js/base.js");
$base = FALSE;
}
if ($ajax && in_array($file, array('ajax', 'ajax_view'))) {
......@@ -1185,7 +1190,7 @@ function views_add_js($file) {
drupal_add_library('system', 'jquery.form');
$ajax = FALSE;
}
ctools_add_js($file, 'views');
drupal_add_js($path . "/js/$file.js");
}
/**
......@@ -1528,6 +1533,7 @@ function views_get_applicable_views($type) {
* If TRUE, reset the static cache forcing views to be reloaded.
*/
function views_get_all_views($reset = FALSE) {
// @todo replace with http://drupal.org/node/1741154.
ctools_include('export');
return ctools_export_crud_load_all('views_view', $reset);
}
......@@ -1663,6 +1669,7 @@ function views_get_view($name, $reset = FALSE) {
}
}
// @todo replace with http://drupal.org/node/1741154.
ctools_include('export');
$view = ctools_export_crud_load('views_view', $name);
if ($view) {
......@@ -2097,7 +2104,6 @@ function views_exposed_form($form, &$form_state) {
if ($view->use_ajax) {
drupal_add_library('system', 'jquery.form');
}
ctools_include('dependent');
$exposed_form_plugin = $form_state['exposed_form_plugin'];
$exposed_form_plugin->exposed_form_alter($form, $form_state);
......@@ -2193,7 +2199,7 @@ function views_exposed_form_cache($views_name, $display_name, $form_output = NUL
* Build a list of theme function names for use most everywhere.
*/
function views_theme_functions($hook, $view, $display = NULL) {
require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'views') . "/theme/theme.inc";
module_load_include('inc', 'views', 'theme/theme');
return _views_theme_functions($hook, $view, $display);
}
......
......@@ -290,6 +290,7 @@ function views_ui_edit_page_title($view) {
* someone else is already editing the view.
*/
function views_ui_cache_load($name) {
// @todo Convert this: http://drupal.org/node/1658068.
ctools_include('object-cache');
$view = ctools_object_cache_get('view', $name);
$original_view = views_get_view($name);
......@@ -330,6 +331,7 @@ function views_ui_cache_set(&$view) {
drupal_set_message(t('Changes cannot be made to a locked view.'), 'error');
return;
}
// @todo Convert this: http://drupal.org/node/1658068.
ctools_include('object-cache');
$view->changed = TRUE; // let any future object know that this view has changed.
......@@ -556,7 +558,6 @@ function views_ui_ctools_plugin_directory($module, $plugin) {
* An array with information about the requested wizard type.
*/
function views_ui_get_wizard($wizard_type) {
ctools_include('plugins');
$manager = new ViewsPluginManager('wizard');
$wizard = $manager->getDefinition($wizard_type);
// @todo - handle this via an alter hook instead.
......@@ -568,10 +569,6 @@ function views_ui_get_wizard($wizard_type) {
$wizard['base_table'] = $wizard_type;
$wizard['title'] = $base_tables[$wizard_type]['title'];
}
// The plugin is neither a base table nor an existing wizard.
else {
vpr('Views Wizard: @wizard does not exist. Be sure to implement hook_ctools_plugin_directory.', array('@wizard' => $wizard_type));
}
}
return $wizard;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment