function _views_maintenance_display_broken_use_cases in Views Maintenance 6
Same name and namespace in other branches
- 7 views_maintenance.views_maintenance.inc \_views_maintenance_display_broken_use_cases()
Returns use cases for broken display and its plugins/handlers if any.
Most part of code was copied from views_ui_import_validate().
Parameters
object $display:
Return value
array
1 call to _views_maintenance_display_broken_use_cases()
File
- ./
views_maintenance.views_maintenance.inc, line 257 - Provides displays use cases info to Views Maintenance.
Code
function _views_maintenance_display_broken_use_cases($display) {
$result = array();
// Check display handler.
if (empty($display->handler) || !empty($display->handler->broken)) {
$result[] = array(
'type' => t('Broken display plugin'),
'status' => 'broken',
'description' => t('Plugin %plugin is not available.', array(
'%plugin' => $display->display_plugin,
)),
);
// Return immediately, there is no sense to continue.
return $result;
}
// Check style plugin and row plugin if it is used.
$plugin = views_get_plugin('style', $display->handler
->get_option('style_plugin'));
if (!$plugin) {
$result[] = array(
'type' => t('Broken style plugin'),
'status' => 'broken',
'description' => t('Plugin %plugin is not available.', array(
'%plugin' => $display->handler
->get_option('style_plugin'),
)),
);
}
elseif ($plugin
->uses_row_plugin()) {
$plugin = views_get_plugin('row', $display->handler
->get_option('row_plugin'));
if (!$plugin) {
$result[] = array(
'type' => t('Broken row plugin'),
'status' => 'broken',
'description' => t('Plugin %plugin is not available.', array(
'%plugin' => $display->handler
->get_option('row_plugin'),
)),
);
}
}
// Check field, argument, sort, filter and relationship handlers.
foreach (views_object_types() as $type => $info) {
$handlers = $display->handler
->get_handlers($type);
if ($handlers) {
foreach ($handlers as $id => $handler) {
if ($handler
->broken()) {
$result[] = array(
'type' => t('Broken handler'),
'status' => 'broken',
'description' => t('@type handler @table.@field is not available.', array(
'@type' => $info['stitle'],
'@table' => $handler->table,
'@field' => $handler->field,
)),
);
}
}
}
}
return $result;
}