1 views.block.inc ViewsBlock::getAdminTitle()

Return an administrative title that will always have a value.

Overrides Block::getAdminTitle

File

core/modules/views/includes/views.block.inc, line 49

Class

ViewsBlock
Displays a view listing as a block, with overriding options.

Code

function getAdminTitle() {
  if (!empty($this->settings['admin_label'])) {
    return check_plain($this->settings['admin_label']);
  }

  list($view_name, $display_id) = explode('-', $this->delta);
  if ($view = views_get_view($view_name)) {
    $view->set_display($display_id);
    if ($block_description = $view->display_handler->get_option('block_description')) {
      $info = t($block_description);
    }
    elseif ($view->display[$display_id]->display_title == $view->display_handler->definition['title']) {
      $info = t('View: @view', array('@view' => $view->get_human_name()));
    }
    else {
      $info = t('View: @view (@display)', array('@view' => $view->get_human_name(), '@display' => $view->display[$display_id]->display_title));
    }

  }
  return $info;
}