Commit acf63142 authored by merlinofchaos's avatar merlinofchaos

#236786: (by KarenS) Make sure all views.*.inc files can be loaded from the...

#236786: (by KarenS) Make sure all views.*.inc files can be loaded from the module's path or module_path/include directory.
parent 5bb097b8
......@@ -45,8 +45,13 @@ function views_ui_list_views($arg = NULL) {
}
}
$path = $view->get_path();
$path = empty($view->disabled) && strpos($path, '%') === FALSE ? l($path, $path) : check_plain($path);
if (!empty($view->display)) {
$path = t('Warning! Broken view!');
}
else {
$path = $view->get_path();
$path = empty($view->disabled) && strpos($path, '%') === FALSE ? l($path, $path) : check_plain($path);
}
$item = array();
$item[] = check_plain($view->name);
$item[] = check_plain($view->description);
......@@ -1577,6 +1582,7 @@ function views_ui_config_item_form(&$form_state) {
$item = $view->get_item($display_id, $type, $id);
if ($item) {
dsm($item);
$handler = views_get_handler($item['table'], $item['field'], $type);
if (empty($handler)) {
$form['markup'] = array('#value' => t("Error: handler for @table > @field doesn't exist!", array('@table' => $item['table'], '@field' => $item['field'])));
......
......@@ -11,36 +11,14 @@
* Load views files on behalf of modules.
*/
function _views_include_handlers() {
$views_path = drupal_get_path('module', 'views') . '/modules';
foreach (module_list() as $module) {
$module_path = drupal_get_path('module', $module);
if (file_exists("$module_path/$module.views.inc")) {
require_once "./$module_path/$module.views.inc";
}
else if (file_exists("$module_path/includes/$module.views.inc")) {
require_once "./$module_path/includes/$module.views.inc";
}
else if (file_exists("$views_path/$module.views.inc")) {
require_once "./$views_path/$module.views.inc";
}
}
views_module_include('views.inc');
}
/**
* Load default views files on behalf of modules.
*/
function _views_include_default_views() {
// Now include the views_default files specifically.
$views_path = drupal_get_path('module', 'views') . '/modules';
foreach (module_list() as $module) {
$module_path = drupal_get_path('module', $module);
if (file_exists("$module_path/$module.views_default.inc")) {
require_once "./$module_path/$module.views_default.inc";
}
else if (file_exists("$views_path/$module.views_default.inc")) {
require_once "./$views_path/$module.views_default.inc";
}
}
views_module_include('views_default.inc');
}
/**
......
......@@ -123,17 +123,7 @@ function views_ui_delete1_confirm_submit(&$form, &$form_state) {
* Convert a Views 1 view to a Views 2 view.
*/
function views1_import($imported) {
// Include the views_convert files specifically.
$views_path = drupal_get_path('module', 'views') . '/modules';
foreach (module_list() as $module) {
$module_path = drupal_get_path('module', $module);
if (file_exists("$module_path/$module.views_convert.inc")) {
require_once "./$module_path/$module.views_convert.inc";
}
else if (file_exists("$views_path/$module.views_convert.inc")) {
require_once "./$views_path/$module.views_convert.inc";
}
}
views_module_include('views_convert.inc');
$view = views_new_view();
......
......@@ -192,8 +192,8 @@ function drupal_process_form_new($form_id, &$form, &$form_state) {
* Usage:
*
* On any form item, add
* - '#process' => 'views_process_dependency' and
* - '#dependency' => array('id-of-form-without-the-#' => array(list, of, values, that, make, this, gadget, visible));
* - @code '#process' => 'views_process_dependency' @endcode
* - @code '#dependency' => array('id-of-form-without-the-#' => array(list, of, values, that, make, this, gadget, visible)); @endcode
*/
function views_process_dependency($element, $edit, &$form_state, &$form) {
if (isset($element['#dependency'])) {
......
......@@ -1787,6 +1787,11 @@ class views_plugin_style_table extends views_plugin_style {
* @param $columns
* An array of all fields; the key is the id of the field and the
* value is the id of the column the field should be in.
* @param $fields
* The fields to use for the columns. If not provided, they will
* be requested from the current display. The running render should
* send the fields through, as they may be different than what the
* display has listed due to access control or other changes.
*/
function sanitize_columns($columns, $fields = NULL) {
$sanitized = array();
......
......@@ -298,6 +298,25 @@ function views_include($file) {
$used[$file] = TRUE;
}
/**
* Load views files on behalf of modules.
*/
function views_module_include($file) {
$views_path = drupal_get_path('module', 'views') . '/modules';
foreach (module_list() as $module) {
$module_path = drupal_get_path('module', $module);
if (file_exists("$module_path/$module.$file")) {
require_once "./$module_path/$module.$file";
}
else if (file_exists("$module_path/includes/$module.$file")) {
require_once "./$module_path/includes/$module.$file";
}
else if (file_exists("$views_path/$module.$file")) {
require_once "./$views_path/$module.$file";
}
}
}
/**
* Include views .css files.
*/
......@@ -632,6 +651,12 @@ function views_get_applicable_views($type) {
continue;
}
if (empty($view->display)) {
// Skip this view as it is broken.
vsm(t("Skipping broken view @view", array('@view' => $view->name)));
continue;
}
foreach ($view->display as $display) {
$plugin = views_fetch_plugin_data('display', $display->display_plugin);
if (!empty($plugin[$type])) {
......
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