You are here

function _views_maintenance_page_context_use_case in Views Maintenance 6

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

Builds use case as context 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

string $task_name: Full task name including task and subtask if any.

array $task: Page manager task definition.

object $handler: Display handler.

object $context: Context object.

Return value

array

1 call to _views_maintenance_page_context_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 196
Provides integration with Page Manager and Panels Mini.

Code

function _views_maintenance_page_context_use_case($task_name, $task, $handler, $context) {
  $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 {
      $status = 'ok';
      $description[] = t('Variant !title is enabled', array(
        '!title' => $handler_title,
      ));
      $context_title = _views_maintenance_context_title($context);
      $description[] = t('Context !title', array(
        '!title' => $context_title,
      ));
    }
  }
  return array(
    'type' => t('Context in Page'),
    'status' => $status,
    'description' => $description,
    'links' => $links,
  );
}