function rb_view_update_real_view in Rules Bonus Pack 7
Updates a view object according to any changes made to a view representation.
Parameters
$view: The view to update. Passed by argument.
$view_representation: The view representation, containing information about any updates that should be make to the view.
3 calls to rb_view_update_real_view()
- rb_views_views_post_render in ./
rb_views.module - Implements of hook_views_post_render().
- rb_views_views_pre_build in ./
rb_views.module - Implements of hook_views_pre_execute().
- rb_views_views_pre_render in ./
rb_views.module - Implements of hook_views_pre_render().
File
- ./
rb_views.module, line 99 - Globally available functions for Rules' Views integration.
Code
function rb_view_update_real_view(view $view, $view_representation) {
// Update all simple (writable) properties.
foreach (rb_views_get_writable_representation_properties() as $representation_property => $view_property) {
$view->{$view_property} = $view_representation->{$representation_property};
}
// Check each handler type, to see if any handler has been modified.
foreach (rb_views_get_views_handlers() as $handler_name => $handler_label) {
if (isset($view->{$handler_name}) && array_keys($view->{$handler_name}) != $view_representation->{$handler_name}) {
// If handlers of a type has been modified, build a new list of handler
// instances according to the view representation, and update the real
// view.
$updated_handlers = array();
foreach ($view_representation->{$handler_name} as $handler_id) {
$updated_handlers[$handler_id] = $view->{$handler_name}[$handler_id];
}
$view->{$handler_name} = $updated_handlers;
}
}
}