You are here

function _views_maintenance_page_pane_use_case in Views Maintenance 7

Same name and namespace in other branches
  1. 6 includes/ctools.inc \_views_maintenance_page_pane_use_case()

Builds use case as pane in page manager page.

Use case should be confirmed outside of this function, it only builds use case array based on states of passed objects.

Parameters

array $task: Page manager task definition.

object $handler: Display handler.

object $pane: Panels pane.

Return value

array

1 call to _views_maintenance_page_pane_use_case()
_views_maintenance_process_page_handlers in includes/ctools.inc
Processes handlers of task or subtask and returns use cases.

File

includes/ctools.inc, line 134
Provides integration with Page Manager and Panels Mini.

Code

function _views_maintenance_page_pane_use_case($task_name, $task, $handler, $pane) {
  $links = array();
  if (user_access('use page manager')) {
    $links[] = l(t('Edit page'), page_manager_edit_url($task_name));
    $links[] = l(t('Pages list'), 'admin/build/pages');
  }
  $description = array();
  $page_title = _views_maintenance_page_title($task_name, $task);
  if (!empty($task['disabled'])) {
    $status = 'unused';
    $description[] = t('Page !title is disabled', array(
      '!title' => $page_title,
    ));
  }
  else {
    $description[] = t('Page !title is enabled', array(
      '!title' => $page_title,
    ));
    $handler_title = _views_maintenance_page_handler_title($handler);
    if (!empty($handler->disabled)) {
      $status = 'unused';
      $description[] = t('Variant !title is disabled', array(
        '!title' => $handler_title,
      ));
    }
    else {
      $description[] = t('Variant !title is enabled', array(
        '!title' => $handler_title,
      ));
      $pane_title = _views_maintenance_content_pane_title($pane);
      if (empty($pane->shown)) {
        $status = 'unused';
        $description[] = t('Pane !title is hidden', array(
          '!title' => $pane_title,
        ));
      }
      else {
        $status = 'ok';
        $description[] = t('Pane !title is visible', array(
          '!title' => $pane_title,
        ));
      }
    }
  }
  return array(
    'type' => t('Content Pane in Page'),
    'status' => $status,
    'description' => $description,
    'links' => $links,
  );
}