You are here

function ds_extras_preprocess_view_layout in Display Suite 7

Same name and namespace in other branches
  1. 7.2 modules/ds_extras/ds_extras.module \ds_extras_preprocess_view_layout()

Implements hook_preprocess_views_view().

1 string reference to 'ds_extras_preprocess_view_layout'
_ds_extras_theme_registry_alter in modules/ds_extras/ds_extras.registry.inc
Implements hook_theme_registry_alter().

File

modules/ds_extras/ds_extras.module, line 816
Display Suite extras main functions.

Code

function ds_extras_preprocess_view_layout(&$variables) {
  if ($layout = ds_get_layout('ds_views', $variables['view']->name . '-' . $variables['view']->current_display, 'default')) {
    $variables['elements']['#entity_type'] = $variables['#entity_type'] = 'ds_views';
    $variables['elements']['#bundle'] = $variables['#bundle'] = $variables['view']->name . '-' . $variables['view']->current_display;
    $variables['elements']['#view_mode'] = 'default';
    $variables['ds_views'] = $variables['view'];
    ds_field_attach_view_alter($variables, array(
      'view_mode' => 'default',
      'entity' => $variables['view'],
    ));

    // Special case for views function fields.
    if (isset($variables['view']->ds_vd)) {
      foreach ($variables['view']->ds_vd as $key => $value) {
        $variables[$key] = $value;
      }
    }

    // Don't remove the variables so we don't trigger notices.
    $variables['preprocess_keep'] = TRUE;
    ds_entity_variables($variables);
    if (isset($variables['#attached'])) {
      drupal_process_attached($variables);
    }
  }
}