You are here

function views_ui_edit_page_display in Views (for Drupal 7) 7.3

Helper function to return the used display_id for the edit page.

This function handles access to the display.

1 call to views_ui_edit_page_display()
views_ui_edit_page in includes/admin.inc
Page callback for the Edit View page.

File

includes/admin.inc, line 895
Provides the Views' administrative interface.

Code

function views_ui_edit_page_display($view, $display_id) {

  // Determine the displays available for editing.
  if ($tabs = views_ui_edit_page_display_tabs($view, $display_id)) {

    // If a display isn't specified, use the first one.
    if (empty($display_id)) {
      foreach ($tabs as $id => $tab) {
        if (!isset($tab['#access']) || $tab['#access']) {
          $display_id = $id;
          break;
        }
      }
    }

    // If a display is specified, but we don't have access to it, return
    // an access denied page.
    if ($display_id && (!isset($tabs[$display_id]) || isset($tabs[$display_id]['#access']) && !$tabs[$display_id]['#access'])) {
      return MENU_ACCESS_DENIED;
    }
    return $display_id;
  }
  elseif ($display_id) {
    return MENU_ACCESS_DENIED;
  }
  else {
    $display_id = NULL;
  }
  return $display_id;
}