function tvi_validate_settings in Taxonomy Views Integrator 7
Check if the views and views' displays referenced by the settings are valid.
They are valid if they stillexists and are still enabled.
Parameters
object $settings: A TVI settings object.
Return value
bool TRUE if the settings are still valid, else FALSE.
1 call to tvi_validate_settings()
- tvi_load_settings in includes/
tvi.query.inc - Load a setting from the database or return a default.
File
- includes/
tvi.query.inc, line 85 - Database interface for the tvi module.
Code
function tvi_validate_settings($settings) {
if (empty($settings) || empty($settings->view_name)) {
return FALSE;
}
// Load the view.
$view = views_get_view($settings->view_name);
// If the view does not exist or if it is disabled.
if (empty($view) || !empty($view->disabled)) {
return FALSE;
}
// If the view's display does not exist.
if (!array_key_exists($settings->display, $view->display)) {
return FALSE;
}
// If the view's display is disabled.
if (array_key_exists('enabled', $view->display[$settings->display]->display_options) && $view->display[$settings->display]->display_options['enabled'] === FALSE) {
return FALSE;
}
$settings->view = $view;
$settings->is_default = FALSE;
return $settings;
}