You are here

function _homebox_get_view_name in Homebox 6.3

Same name and namespace in other branches
  1. 6 homebox.module \_homebox_get_view_name()
  2. 6.2 homebox.module \_homebox_get_view_name()
  3. 7.3 homebox.module \_homebox_get_view_name()
  4. 7.2 homebox.module \_homebox_get_view_name()

Get the name of the view based on the block

Parameters

$block: A block object

Return value

The name of the view

1 call to _homebox_get_view_name()
homebox_prepare_block in ./homebox.module
Prepare a block for rendering with theme('homebox_block').

File

./homebox.module, line 1166
Homebox main file, takes care of global functions settings constants, etc.

Code

function _homebox_get_view_name($block) {
  $delta = $block->delta;

  // if this is 32, this should be an md5 hash.
  if (drupal_strlen($delta) == 32) {
    $hashes = variable_get('views_block_hashes', array());
    if (!empty($hashes[$delta])) {
      $delta = $hashes[$delta];
    }
  }

  // This indicates it's a special one.
  if (drupal_substr($delta, 0, 1) == '-') {
    list($nothing, $type, $name, $display_id) = explode('-', $delta);
    if ($view = views_get_view($name)) {
      $name = $view->display[$display_id]->display_options['block_description'];
      $view
        ->destroy();
    }
  }
  list($name, $display_id) = explode('-', $delta);

  // Load the view
  if ($view = views_get_view($name)) {
    $name = $view->display[$display_id]->display_options['block_description'];
    $view
      ->destroy();
  }
  return $name;
}