You are here

function theme_asset_widget_view_mode_switch_block in Asset 7

Return html for asset view mode switch block.

1 theme call to theme_asset_widget_view_mode_switch_block()
template_preprocess_asset__widget_search in modules/asset_widget/theme/theme.inc
Preprocess variables for asset--widget-search.tpl.php.

File

modules/asset_widget/theme/theme.inc, line 311
Module related preprocesses and theme overrides.

Code

function theme_asset_widget_view_mode_switch_block(&$vars) {
  $output = '';
  if (!empty($vars['asset']->type)) {
    if (($view_modes = _assets_get_wysiwyg_modes($vars['asset']->type)) && is_array($view_modes)) {
      $view_modes = array_keys($view_modes);
      foreach ($view_modes as $key => &$view_mode) {
        $classes = array(
          "view-{$view_mode}",
        );
        if ($key == 0) {
          $classes[] = 'active';
        }
        $classes = implode(' ', $classes);
        $view_mode = '<li class="' . $classes . '"><strong>' . $view_mode . '</strong></li>';
      }
      $output = '<ul>' . implode('', $view_modes) . '</ul>';

      // Add arrows.
      if (count($view_modes) > 1) {
        $output = '<span class="low"></span>' . $output . '<span class="high"></span>';
      }

      // Add wrapper.
      $output = '<div class="size sizes">' . $output . '</div>';
    }
  }
  return $output;
}